Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.