home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!paladin.american.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!noc.msc.net!uc.msc.edu!shamash!ems!ems.cdc.com!mstemper
- From: mstemper@ems.cdc.com (Michael Stemper)
- Newsgroups: comp.lang.fortran
- Subject: Re: Help. Need Help in writing this program.
- Message-ID: <21195@nntp_server.ems.cdc.com>
- Date: 25 Aug 92 17:59:22 GMT
- References: <1992Aug24.183954.24423@uceng.UC.EDU>
- Sender: sys@ems.ems.cdc.com
- Reply-To: mstemper@ems.cdc.com
- Organization: Empros Systems International, a division of Ceridian
- Lines: 60
- Nntp-Posting-Host: kirk.ems.cdc.com
-
- In article <1992Aug24.183954.24423@uceng.UC.EDU>, pviswana@uceng.UC.EDU (Prashanth V.) writes:
- |>
- |> The input is the number of Branch instructions the fortran program
- |> must contain.
- |>
- |> Ouput a fortran program that will contain the specified number of
- |> branch instructions. Is this possible in Fortran?
- |>
- Well, it depends on what you mean by branch instructions. If you mean
- that your program is to generate another program that has a specified
- number of GO TO statements, would the following be an acceptable output
- of your program, given an input of 4?
-
- PROGRAM ANSWER
- *
- GO TO 1
- 1 CONTINUE
- *
- GO TO 2
- 2 CONTINUE
- *
- GO TO 3
- 3 CONTINUE
- *
- GO TO 4
- 4 CONTINUE
- *
- STOP
- END
-
- This was generated with a program that took about two minutes to write
- and test. If this is not what your professor is looking for, let us
- know the remainder of the homework problem's stated constraints.
-
- If you need hints on how to write something like this,
- 'DO loop', 'READ', 'WRITE', 'FORMAT' are good hints.
-
- If you want the program that generated the above program, email me any
- time after September 6.
-
- In answer to your question about is this possible in FORTRAN, there is
- a general concept called a Turing Machine. You will learn about this
- in later classes. A simple explanation is:
-
- " A Turing Machine (TM) is a mathematical representation of the most
- powerful computer it will ever be possible to build. With the
- model of a TM, you can PROVE whether certain things can or cannot
- (even theoretically) be done. A computer language may be said to
- be TM equivalent if it can do everything that a TM can do."
-
- All languages that are TM equivalent can solve the same set of
- problems. FORTRAN, C, PASCAL, LISP (to name only a few) are all
- TM equivalent. Therefore, what can be done in one of them can be
- done in another - no more, no less.
-
- --
- #include <Standard_Disclaimer.h>
- Michael F. Stemper
- Power Systems Consultant
- mstemper@ems.cdc.com
-