Opengl Press Any Key to Continue

Press any key to continue...

Discussion in 'Software' started by neverett08, May 7, 2005.

?

Was this question a waste of time to you?

  1. Yes

    0 vote(s)
    0.0%
  2. No

    3 vote(s)
    100.0%
  1. neverett08

    neverett08 Private E-2

    Does anyone know how to program something like this:

    cout << "Hello, World!" << endl;
    cout << "\nPress any key to continue...";

    I don't know how to make the program pause then continue by pressing any key. Can anyone help?

    Thanks,

    Nic

    neverett08, May 7, 2005
    #1
  2. goldfish

    goldfish Lt. Sushi.DC

    I don't know how to do it in C/C++, but in QBASIC you make a loop which goes around until a key is pressed. So somthing like this:
    Code:
    PRINT "Press any key..." DO WHILE $INKEY = ""  LOOP PRINT "Continuing"                          
    Using the same principle you could probably do the same in whatever language you're using.
    goldfish, May 7, 2005
    #2
  3. kuku

    kuku Specialist

    If you use a "cin" to get a user input after your last line won't it by default just sit there until the user presses something?
    kuku, May 7, 2005
    #3
  4. iamien

    iamien Cptn "Eh!"

    as follows
    Code:
                                  #include <iostream> #include <conio> using namespace std;  int main() { //bla blah blah cout<<"Press any key to continue"; getch(); }                          
    o
    the question wasnt a waste of time.
    the poll sure was though
    iamien, May 7, 2005
    #4
  5. iamien

    iamien Cptn "Eh!"

    Yes,
    but the console would be like this

    press any key...
    they press their key... but nothing happens until you hit enter
    we want the reaction right away no matter what key is hit

    iamien, May 7, 2005
    #5
  6. Maxwell

    Maxwell Folgers

    cin would require that the user presses the return key to enter the data into the application. What you need is something the "polls" the keyboard and as soon as any key is pressed allow the application to continue. In C you can do this via a call to getc: http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/libs/basetrf1/getc.htm I don't know what the C++ equivalent is but it may involve a variant of cin?
    Maxwell, May 7, 2005
    #6
  7. iamien

    iamien Cptn "Eh!"

    as far as i know there is no cin method to do this.
    In class we just used getch().. but we also use .h headers so we arn't that modern.
    Looking at the cin class overview might help
    http://www.cplusplus.com/ref/iostream/istream/
    From what i read, i supose the follow
    the stream buffer should be empty. if it is
    then wait for a character to appear in the buffer, and when it does, break out of the waiting loop
    iamien, May 7, 2005
    #7
  • Forgot your password?

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds


eddinspried1962.blogspot.com

Source: https://forums.majorgeeks.com/threads/press-any-key-to-continue.62278/

0 Response to "Opengl Press Any Key to Continue"

Postar um comentário

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel