Hi;
Does ftn95 have anything like the TrueBasic INPUT PROMPT statement?
It's used to ask the user to input a value and wait for a reply on the same line.
Tia,
Roger
Welcome to our forums
Hi;
Does ftn95 have anything like the TrueBasic INPUT PROMPT statement?
It's used to ask the user to input a value and wait for a reply on the same line.
Tia,
Roger
integer i,j
do
write(*,'(A,$)')'Enter a number, 0 to quit: '
read(*,*)i
write(*,*)' you entered: ',i
if(i.eq.0)exit
end do
write(*,*)' Program completed '
end program
Ok, that works!
I understand the A format but what is $ doing to prevent a newline?
Thanks,
Roger
The $ control descriptor (sometimes a backslash is used for the same purpose) is a non-standard but fairly common device created precisely to facilitate terminal I/O.
Remember, Fortran was widely used in the '60s, and CRT and teletype terminals were not much used by normal people (as opposed to sysadmins), so when CRT terminals became popular in the '70s, some means was needed to suppress the carriage return that normally came after a line of output.
Ok, thanks.
TrueBasic does it with a ; at the end of the write statement.
The $ means string variable to me.
Roger