Thread: How do I make my program pause

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User quiksilver9531's Avatar
    Join Date
    Nov 2001
    Posts
    36

    How do I make my program pause

    Im writing this program for school...but I'm curious how I would make it pause. I will include the code::

    include <fstream.h>


    int main()
    {
    int max, min, guess;
    char answer;


    cout << "Enter a maxium number : ";
    cin >> max;
    cout << "Enter a minium number : ";
    cin >> min;
    cout <<endl;
    cout <<"Think of a number between your maxium and minium number"<<endl;
    cout <<"This program will guess it"<<endl;
    cout <<endl;
    cout <<"You have 5 seconds before the program will attempt to guess it" <<endl;
    ---I WANT IT TO PAUSE HERE BEFORE IT GOES INTO THE DO----
    do
    {
    guess = (min + max) / 2;

    cout <<" Is this number correct : " << guess <<endl;
    cout <<" If it is please enter Y. " <<endl;
    cin >> answer;
    cout <<endl;

    if ( answer == 'Y' || answer == 'y')
    {
    cout <<"The computer rules " <<endl;
    continue;
    }

    cout <<" If the number was incorrect: "<<endl;
    cout <<" -- Enter an H for higher. "<<endl;
    cout <<" -- Or an L for lower. "<<endl;
    cin >>answer;
    cin.ignore (80, '\n');

    if (answer == 'H' || answer == 'h')
    { min=guess; }
    else
    { max=guess; }

    }

    while ( answer != 'Y' && answer != 'y' );

    return 0;
    }


    THanks alot
    Last edited by quiksilver9531; 01-23-2002 at 06:10 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 06-17-2008, 11:38 AM
  2. How to make the program not to wait for the function?
    By maxorator in forum C++ Programming
    Replies: 10
    Last Post: 10-02-2005, 03:02 PM
  3. How do you make your program record keystrokes
    By aaroroge in forum C++ Programming
    Replies: 1
    Last Post: 06-25-2005, 06:55 AM
  4. make a program stay....
    By Nirav in forum C Programming
    Replies: 6
    Last Post: 10-12-2003, 07:01 PM
  5. pause program at console
    By datainjector in forum C# Programming
    Replies: 1
    Last Post: 03-27-2003, 12:36 AM