Thread: reading input

  1. #1
    Registered User
    Join Date
    Oct 2001

    Question reading input

    I want to do a standard prompt to ask a user to input an integer value and then read this value and assign it to a unsigned char which I have already initialised so that the unsigned char variable has this value.
    I imagine I use a standard printf for the prompt and if it was a char use scanf and then the get function but how do i do what i need to do stated above??

  2. #2
    Registered User
    Join Date
    Aug 2001
    as someone who prefer streams over printf()/scanf() you could try this:

    cout << "enter a single numeric digit 0-9" << endl;
    char ch;
    cin >> ch;

    with printf()/scanf() it would be something like this, I think:

    printf("enter a single numeric digit 0-9");
    char ch;
    scanf(%c, &ch);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can someone help me with these errors please code included
    By geekrockergal in forum C Programming
    Replies: 7
    Last Post: 02-10-2009, 02:20 PM
  2. Need some help with C program writing
    By The_PC_Gamer in forum C Programming
    Replies: 9
    Last Post: 02-12-2008, 09:12 PM
  3. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  4. Help with linked list (and reading user input)
    By p1kn1c in forum C Programming
    Replies: 2
    Last Post: 04-05-2006, 12:43 AM
  5. Reading input as an integer
    By n0de in forum C++ Programming
    Replies: 4
    Last Post: 04-11-2002, 06:52 PM