Multiple variable input

Anybody know how to put multiple variables into one readln? Or if it is even possible?

Comments

  • : 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[code]Var A,B,C:Byte;
    Begin
    ReadLn(A,B,C);
    WriteLn('A=',A,' B=',B,' C=',C);
    ReadLn;
    End.[/code]
  • thanks my friend, i was unsure wether or not i could
  • : Anybody know how to put multiple variables into one readln? Or if
    : it is even possible?
    :
    :
    [code]
    Var
    i,j,k : Integer ;
    x,y,x : Real ;

    begin
    ReadLn (i, j, k, x, y, z) ;
    [/code]
    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 [b]EoLn[/b]. I don't think it can be done with strings, or if it can, it's not worth the effort.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories