Thread: cout and cin

  1. #1
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490

    cout and cin

    is it possible to create something like cout, but which can handle both input and output? i.e.:
    Code:
    int temp_in=0;
    while(1) {
    cboth << "type a number: ";
    cboth >> temp_in;
    cboth << "\nyou typed the wrong number. try again\n";
    }
    (i know it's an endless loop, meant to aggrivate the user)

  2. #2
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    CTRL C or a baseball bat stops all running loops.
    Blue

  3. #3
    Unregistered
    Guest
    sure, but i think it could would making debugging difficult. you'll have to overload the >> and << operators.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary I/O with cin and cout
    By The Urchin in forum C++ Programming
    Replies: 4
    Last Post: 10-24-2006, 12:47 PM
  2. Overriding Cin with Cout
    By Tainted in forum C++ Programming
    Replies: 5
    Last Post: 10-06-2005, 02:57 PM
  3. I'm REALLY confused. Why isn't cout or cin working here?
    By niudago in forum C++ Programming
    Replies: 8
    Last Post: 02-15-2003, 05:53 PM
  4. cin and cout
    By quentin in forum C++ Programming
    Replies: 6
    Last Post: 04-27-2002, 02:04 PM
  5. i don't know about cin, cout, flag.
    By comwin in forum C++ Programming
    Replies: 2
    Last Post: 11-08-2001, 04:26 AM