freepascal - How to compare string to integer with while do loop in pascal? -
how compare string integer using while loop in pascal?
this:
var destination:string; while (destination>'11') begin writeln('error'); write('destination number'); readln(destination); end;
you have convert destination
integer:
program project1; uses sysutils; var converted: integer; destination: string; begin converted := 12; destination := ''; while (converted > 11) begin writeln('error'); writeln('destination number'); readln(destination); converted := strtointdef(destination, 12); end; end.
convertion routines avalaible in sysutils:
http://www.freepascal.org/docs-html/rtl/sysutils/index-5.html
Comments
Post a Comment