beginner nd help

This is a discussion on beginner nd help within the C++ Programming forums, part of the General Programming Boards category; can i know how to want the user to insert only words without numbers and vice verse? i want limit ...

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    9

    beginner nd help

    can i know how to want the user to insert only words without numbers and vice verse?
    i want limit it to insert either words or numbers or else ask the user to reenter the value

    cout<<"Please enter your name:";
    cin.getline (name,50);

    cout<<"Please enter your nick name:";
    cin.getline (nickname,50);

    cout<<"Please enter your hobby:";
    cin.getline (hobby,50);

    cout<<"Please enter your phone number:";
    cin>>phone_number;

    cout<<"Please enter your birthdate(ddmmyyyy):";
    cin>>birthdate;

    cout<<"Please enter your identity card number:";
    cin>>ic_number;

    thx 4 helping...

  2. #2
    Registered User
    Join Date
    Sep 2010
    Posts
    31
    It would be great to know what kind of variables these are. Please post more of the code.

    If you are using <string> or <char>, remember that data of these types are actually stored by their ASCII values. You could use if() statements to check if the characters in a given string are within a particular range of values.

    You can find a copy of the ASCII chart here.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ADO.NET in VS2008 or gdi+ (beginner question)
    By robgar in forum C# Programming
    Replies: 3
    Last Post: 10-04-2009, 03:40 AM
  2. Same old beginner question...
    By Sharmz in forum C Programming
    Replies: 15
    Last Post: 08-04-2008, 12:48 PM
  3. What are some good beginner programs I shouold make?
    By oobootsy1 in forum C# Programming
    Replies: 6
    Last Post: 08-09-2005, 03:02 PM
  4. Windows programming for beginner (Absolute beginner)
    By WDT in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2004, 11:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21