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
    Likes Received:
    0
    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. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.