Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

FORTRAN

Name: Anonymous 2010-10-31 18:51

I am writing a short program in Fortran 95 as an excercise (and, please, I don't need to hear how Fortran is now obsolete -I have had no programming experience whatsoever up until quite recently and it was suggested to me as a good introduction). I have stumbled upon a problem which I am sure anyone more experienced than I am will be able to overcome.

I want the program to have a "command line": you enter some words, separated by blanks, and these are allocated to 5 character variables, len=10. The problem is, the READ*, command will force me to always input 5 values. I have programmed, for instance, the program to quit if one of the five variables is "EXIT". But, even if one of them is, I still have to input 5 words for the READ*, command to be executed, and then proceed to the next command. Is there a way that I can bypass this, so that I type "EXIT", press ENTER and then the READ*, function is executed, without changing lines? I've looked into FORMAT, and it doesn't seem to help (me, at least). Any help is greatly appreciated.

tl;dr: Fortran READ*, command which allocates 5 words to character variables is not executed until 5 words have been typed. How to program so that any number of words can be typed, then ENTER is pressed and the command is executed?

Name: Anonymous 2010-10-31 19:02

>>1
it was suggested to me as a good introduction
YHBT

Name: Anonymous 2010-10-31 19:42

Read the words one by one and put them in an array or something.
Though if you ever need to read something in Fortran than isn't a huge list of preformated data, you're using the wrong language.

Name: Anonymous 2010-10-31 23:17

Don't waste your time on Fortran. Obsolete or not, it's a terrible introductory language.
Learn Python or something.

Name: Anonymous 2010-12-01 21:28

>FORTRAN
>Introductory

Who the hell suggested it to you? It must have been a Biologist. God fucking knows why they still use it.

Name: Anonymous 2011-02-04 13:14

Don't change these.
Name: Email:
Entire Thread Thread List