Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Multiple variable input Posted by Enterti on 30 Apr 2009 at 5:25 PM
Anybody know how to put multiple variables into one readln? Or if it is even possible?

Report
Re: Multiple variable input Posted by w0lfg4 on 30 Apr 2009 at 5:42 PM
: Anybody know how to put multiple variables into one readln? Or if
: it is even possible?
:
:
You have to enter the values separated with a SPACE
Var A,B,C:Byte;
Begin
 ReadLn(A,B,C);
 WriteLn('A=',A,' B=',B,' C=',C);
 ReadLn;
End.

Report
Re: Multiple variable input Posted by Enterti on 30 Apr 2009 at 5:44 PM
thanks my friend, i was unsure wether or not i could
Report
Re: Multiple variable input Posted by Actor on 30 Apr 2009 at 5:52 PM
: Anybody know how to put multiple variables into one readln? Or if
: it is even possible?
:
:
Var
   i,j,k : Integer ;
   x,y,x : Real ;

begin
   ReadLn (i, j, k, x, y, z) ;

When the operator enters the data from the keyboard he must delimit the variables with blanks. There is a tendency for operators to put commas between the variables, which doesn't work. The same goes if the data is coming from a text file; use blanks as delimiters.

Entering multiple strings this way is problematic since they are delimited by EoLn. I don't think it can be done with strings, or if it can, it's not worth the effort.




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.