This is in Delphi (Object Pascal) but you should get the idea. Bascially, declare the phone number as an integer, then trap the exception that would occur if they enter a character.
If you want to go back up so they have to enter it again, just use a label.
Code:
program Project2;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
phonenumber :integer;
begin
writeln('Enter Customer Phone Number:');
try
readln(phonenumber);
except
writeln('Oops, you enter something other than 0-9');
end;
writeln('done');
readln;
end.
Bookmarks