2 simple questions

This is a discussion on 2 simple questions within the C Programming forums, part of the General Programming Boards category; hi... suppose that a certain program asks me to input a 2 digit value. 1- if I give the value ...

  1. #1
    pancho
    Guest

    Question 2 simple questions

    hi...
    suppose that a certain program asks me to input a 2 digit value.

    1- if I give the value 01, is it gonna be interpreted as 1?
    2- what I have to do in scanf in order to restrict the digit to two intergers. is this right: scanf( "%2d", value ); ?????????
    if not, how I do it?

    thanks a lot...

  2. #2
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    One way i think of is turn the integer received into a string. Then split up the two digits again to be intepreted as two numbers?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 09:47 AM
  2. A couple questions
    By Flakster in forum C++ Programming
    Replies: 7
    Last Post: 08-09-2005, 02:22 PM
  3. Few simple questions...
    By Shane in forum C++ Programming
    Replies: 9
    Last Post: 08-06-2005, 03:40 AM
  4. A few simple batch questions
    By sean in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 07-02-2003, 02:35 PM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 08:22 AM

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