limit the number of digits in c++

Discussion in 'C Programming' started by Aleena, May 31, 2012.

  1. Aleena

    Aleena

    Joined:
    May 31, 2012
    Messages:
    1
    i m a new user of c++. m making a simple program but i dont know which data type should i use. i want to limit the users input to 13 digits

    #include<iostream.h>
    #include<conio.h>
    void main()
    {
    int a;
    clrscr();
    cout<<"Enter the cnic number:";
    cin>>a;
    if(a<=1000000000000 && a<10000000000000)
    if(a%2==0)
    cout<<"Female";
    else
    cout<<"Male";
    else
    cout<<"Invalid";
    getch();
    }

    hope you get my point. any help????? do tell my mistakes . thanks
     
    Aleena, May 31, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marc Schellens

    Number of digits of float value

    Marc Schellens, Apr 21, 2004, in forum: C++
    Replies:
    4
    Views:
    6,710
    Ivan Vecerina
    Apr 21, 2004
  2. guru.slt@gmail.com
    Replies:
    1
    Views:
    1,087
    Victor Bazarov
    Jun 28, 2005
  3. bejiz
    Replies:
    12
    Views:
    617
    robertwessel2@yahoo.com
    Sep 27, 2007
  4. Chris Rebert
    Replies:
    1
    Views:
    389
    Grant Edwards
    Nov 5, 2010
  5. Tim Chase
    Replies:
    2
    Views:
    555
    Tim Chase
    Nov 6, 2010
Loading...

Share This Page