Thread: simple i/o question

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    irregularly symmetrical n3v's Avatar
    Join Date
    Mar 2006
    Location
    Finland
    Posts
    67

    simple i/o and array question

    right, i'm having problems with something stupid involving input and arrays.

    Code:
        char number[256];
        cout << "enter a number" << endl;
        cin.getline(number,256);
        cout << "the number is" << endl;
             for (int i = 0;i > ???;i++) {
                 cout << number[i];
                 }
        cout << endl;
    what do i put in that red area to output the correct number?

    I know that if i put in 256, and if the number entered has less than 256 digits, then the program messes up. how can i figure out which units in the array are being used?

    i know this system isn't the way numbers are usually handled, but i'm doing something different involving very large numbers.
    Last edited by n3v; 04-06-2006 at 08:03 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple Question!!
    By gameuser in forum C++ Programming
    Replies: 2
    Last Post: 06-06-2009, 05:42 PM
  2. Simple question about file I/O.
    By The7thCrest in forum C++ Programming
    Replies: 2
    Last Post: 02-04-2009, 05:15 PM
  3. simple I/O question
    By Mortissus in forum C++ Programming
    Replies: 7
    Last Post: 02-14-2005, 10:14 AM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. Overlapped I/O and Completion Port :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 10-30-2002, 05:14 PM