help...run time error - Programmers Heaven

Howdy, Stranger!

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

Categories

help...run time error

masterakosmasterakos Posts: 7Member
hello ppl,

i would like some help on something which i am not sure if its possible...i am "new" so dont missunderstand me plz :P

while reading a string for example...and i insert an integer as a value to the string variable...
how can i keep the program running

thank you...

Comments

  • _Atex__Atex_ Posts: 163Member
    : while reading a string for example...and i insert an integer as a
    : value to the string variable...
    : how can i keep the program running

    You have to covert the string value into an integer using the [b]val[/b] procedure. For example:[code]var s:string;
    i,code:integer;

    {...}
    write('Enter an integer:');readln(s); { <-- reading into a string type }
    val(s,i,code);
    if code=0 then writeln('The integer entered: ',i)
    else writeln('Error at position: ',code); { <-- In case you entered something wrong }
    {...}[/code]


  • masterakosmasterakos Posts: 7Member
    i tried it...a huge thank you it rly help me a lot!!!

    i made a big proggram and there were only 2 little holes to crash the program...now it will be perfect...

    THANK YOU again :]
Sign In or Register to comment.