Thread: Just receive numbers (0-9) as input.

  1. #1
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Posts
    807

    Just receive numbers (0-9) as input.

    I tried something like that:

    Code:
    //Receive the max questions of the game
        //Receive the max questions of the game
        do {
        printf("\nHow Many questions at all game? (I.E: 10)\n");
        scanf("%d",&max_questions); } while(isdigit(max_questions) != 0);
    But he receives letters too, and this causes a big problem on my App, whats wrong here?

    I dont know too much about isdigit(), I think he return 1+ when is just numbers and 0 when its an char, right?

    Someone can help? this seems to be easy for those who knows
    Thanks!!!!

  2. #2
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Posts
    807

    I didnt understood you too much..

    I want to use isdigit(), I think the problem is that I need to send an char for isdigit instead int, right?

    or maybe because I didnt wrote well the do...while loop.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. entering numbers to array in a row whithout length input
    By transgalactic2 in forum C Programming
    Replies: 55
    Last Post: 01-02-2009, 04:02 AM
  2. For loop problems, input please.
    By xIcyx in forum C Programming
    Replies: 2
    Last Post: 04-22-2007, 03:54 AM
  3. I would love some input on my BST tree.
    By StevenGarcia in forum C++ Programming
    Replies: 4
    Last Post: 01-15-2007, 01:22 AM
  4. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  5. Can we input negative numbers in the output windiw
    By hitesh1511 in forum C Programming
    Replies: 1
    Last Post: 08-22-2006, 12:07 AM