Thread: My best C++ Programs

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    cout << "Enter your bet->";
    cin >> bet;

    while (cin.fail())
    {
    cout << "Invalid input, please restate->";
    cin >> bet;
    }

    Should catch the program before it 'bottoms out'; I think
    I should elaborate.. if what the user enters is not compatable with the variable type in which it is to be stored.. you'll get that unexpected behavior.

    Someone should correct me on this If I'm wrong
    Last edited by Dual-Catfish; 02-17-2002 at 12:33 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Recommend upgrade path for C programs
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-22-2007, 07:32 AM
  2. How come Dev C++ cant run some programs??
    By Sephiroth in forum C Programming
    Replies: 41
    Last Post: 09-17-2005, 05:35 AM
  3. Way to get the current open programs displayed?
    By CPPguy1111 in forum C++ Programming
    Replies: 6
    Last Post: 06-22-2005, 12:24 AM
  4. POSIX/DOS programs?
    By nickname_changed in forum C++ Programming
    Replies: 1
    Last Post: 02-28-2003, 05:42 AM
  5. executing c++ programs on the web
    By gulti01 in forum C++ Programming
    Replies: 4
    Last Post: 08-12-2002, 03:12 AM