quick question

This is a discussion on quick question within the C++ Programming forums, part of the General Programming Boards category; I have a quick question. how can I make a program stop and then start running again by pressing a ...

  1. #1
    Unregistered
    Guest

    quick question

    I have a quick question.
    how can I make a program stop and then start running again by pressing a key. something like 'readkey' and so to resume. I want to use this so the user on my program can read the text displayed before it is cleared by the system ("CLS").

    thx in advance.

  2. #2
    Unregistered
    Guest
    //code
    char ch;
    cin >> ch;
    //code


    in the above sequence the program will pause indefinitely as long as the input buffer is empty at the time the line cin >> ch; is encountered and will resume as soon as any key is entered.

    if your compiler has the conio header file, then you can use the kbhit() function as an alternate mechanism.

  3. #3
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608
    system ("pause"); i think it uses the same header as for the cls one
    Email: Klinerr1@nc.rr.com || AIM: MisterSako || MSN: sakotheinsane@hotmail.com

    -the shroom has spoken

  4. #4
    Unregistered
    Guest
    thx. the system ("paused") was what I wanted.

  5. #5
    Registered User moonwalker's Avatar
    Join Date
    Jul 2002
    Posts
    282

    must be in

    It must be in one of these:

    stdio.h
    stdlib.h
    dos.h

    But how do we get to check which function is in which ?

  6. #6
    Registered User Unreg1stered's Avatar
    Join Date
    Jul 2002
    Posts
    25
    It's in stdlib.h .

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quick Question
    By Necrofear in forum Tech Board
    Replies: 9
    Last Post: 12-04-2005, 09:14 AM
  2. Very quick math question
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 10-27-2005, 12:05 AM
  3. very quick question.
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 07-24-2002, 04:48 AM
  4. Quick Question Regarding Pointers
    By charash in forum C++ Programming
    Replies: 4
    Last Post: 05-04-2002, 12:04 PM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 06:46 PM

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