User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Pascal and Delphi section within the Software Development category of DaniWeb, a massive community of 391,555 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,625 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Pascal and Delphi advertiser:
Views: 880 | Replies: 2
Reply
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  
Join Date: Apr 2007
Posts: 9
Reputation: yhoezt is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
yhoezt yhoezt is offline Offline
Newbie Poster

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

  #2  
Apr 25th, 2007
why not u use array in ['0',..,'9']...so if user enter in that array..u show the error message...
Reply With Quote  
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

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

  #3  
Apr 26th, 2007
Interesting..good thinking thanks.. but would that not still limit the answer to just being an integer tho?
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Pascal and Delphi Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Pascal and Delphi Forum

All times are GMT -4. The time now is 9:37 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC