RSS Forums RSS
Please support our Pascal and Delphi advertiser: Programming Forums

Pascal : How to display an error msg when integer entered for a name?

Join Date: Apr 2007
Location: Glasgow
Posts: 32
Reputation: adotl is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
adotl's Avatar
adotl adotl is offline Offline
Light Poster

Help Pascal : How to display an error msg when integer entered for a name?

  #1  
Apr 25th, 2007
I dont know if Im far off with this, The user enters their name and I want them to only enter in a string so if they enter in a number Id like an error message, any ideas?


program Word;
uses crt;
   var
      letter: string;
   begin
      clrscr;
      Repeat
         writeln('What is your name? ');
         readln(letter);
         if (letter >=UPCASE('a')) AND (letter <=UPCASE('z')) then
         begin
            writeln('Correct Answer ');
         end
         else
         begin
            writeln('Word needs to be entered');
            end;
      Until (letter >=UPCASE('a')) AND (letter <=UPCASE('z'));
      {-------------------Printing Results------------------}
      writeln('The name is ', letter);
      readln;
   end.
AddThis Social Bookmark Button
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 11:29 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC