View previous topic :: View next topic |
Author |
Message |
rogerh
Joined: 02 Nov 2014 Posts: 46 Location: Longmont, CO
|
Posted: Wed Nov 12, 2014 9:39 pm Post subject: user input code |
|
|
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 |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1885
|
Posted: Wed Nov 12, 2014 9:53 pm Post subject: |
|
|
Code: | 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 |
|
|
Back to top |
|
|
rogerh
Joined: 02 Nov 2014 Posts: 46 Location: Longmont, CO
|
Posted: Wed Nov 12, 2014 10:10 pm Post subject: |
|
|
Ok, that works!
I understand the A format but what is $ doing to prevent a newline?
Thanks,
Roger |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1885
|
|
Back to top |
|
|
rogerh
Joined: 02 Nov 2014 Posts: 46 Location: Longmont, CO
|
Posted: Wed Nov 12, 2014 11:33 pm Post subject: |
|
|
Ok, thanks.
TrueBasic does it with a ; at the end of the write statement.
The $ means string variable to me.
Roger |
|
Back to top |
|
|
|