Howdy, Stranger!

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

Categories

Can't read words into program

polaris1920polaris1920 Member Posts: 3
I can't read words into a program.
Example of code
Var Emp : String;
Sal : Integer;
Begin
Write ('Input name');
Read (Emp);
Write ('Input salary');
Read (Sal);
Writeln ('Name is', Emp);
Writeln ('Salary is', Sal);
End.

When I run the program it skips the part where I'm soposed to input the name.

Comments

  • steveXPsteveXP Member Posts: 22
    : I can't read words into a program.
    : Example of code
    : Var Emp : String;
    : Sal : Integer;
    : Begin
    : Write ('Input name');
    : Read (Emp);
    : Write ('Input salary');
    : Read (Sal);
    : Writeln ('Name is', Emp);
    : Writeln ('Salary is', Sal);
    : End.
    :
    : When I run the program it skips the part where I'm soposed to input the name.


    Polaris change your Read statements to Readln(); and it should work, fine. Both your Read statements are catching the same enter press. And at the end of your program type the following so you can see your output.

    Readln;
    or
    Repeat Until Keypressed; {Uses Crt unit}

    Hope that helps ya
    SteveXp o(-_-)o
  • Chris BrownChris Brown USAMember Posts: 4,496 ✭✭

    ___ || http://forcoder.org || free ebooks and video tutorials about { MATLAB, Ruby, Perl, Delphi, C#, Assembly, Visual Basic .NET, Java, Scratch, Go, PHP, C, PL/SQL, R, Visual Basic, Swift, C++, Python, JavaScript, Objective-C Lisp, Scheme, Clojure, Rust, Hack, Scala, Dart, Awk, Ada, Prolog, Logo, COBOL, F#, Fortran, VBScript, Erlang, Lua, LabVIEW, Bash, SAS, Crystal, ABAP, D, Alice, Transact-SQL, FoxPro, ML, Apex, Kotlin, Julia } ___

Sign In or Register to comment.