If i have a program where it asks "Press space to continue "
How can I do it ? I have seen it done like that before, like "char a=getch()" or something like that. Sorry for being so vague
If i have a program where it asks "Press space to continue "
How can I do it ? I have seen it done like that before, like "char a=getch()" or something like that. Sorry for being so vague
Stan The Man. Beatles fan
When I was a child,
I spoke as a child,
I thought as a child,
I reasoned as a child.
When I became a man,
I put childish ways behind me"
(the holy bible, Paul, in his first letter to the Cor. 13:11)
If you're using getch make sure you include conio.hCode:cout << "Press any key to continue"; cin.get(); // or cout << "Press any key to continue"; char a = getch();
I am against the teaching of evolution in schools. I am also against widespread
literacy and the refrigeration of food.
Use getchar( ) don't use getch( ) because its not ANSI standard.
"...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers
Or just read the FAQ's:
http://www.cprogramming.com/boardfaq.html#pause
http://www.cprogramming.com/cboard/s...threadid=27714
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
What library to use?Originally posted by MrWizard
Use getchar( ) don't use getch( ) because its not ANSI standard.
none...
Its included in standard input/output (stdio.h)
I think that in MVSC it is included with the standard library.
Of course I know how to pause, but I mean if you want the program only to continue if the user hits a specific key. Or only does a specific task if that key is entered. I know I could use a switch statement, or if(a=='H') but what if I need only space.
Example
(i don't know how to use code tags, so hammer go ahead and go crazy)
cout << "Hit space to fire";
?????????? // don't know what to hit here
BTW, how does getchar work, because I like to keep with standards
Stan The Man. Beatles fan
When I was a child,
I spoke as a child,
I thought as a child,
I reasoned as a child.
When I became a man,
I put childish ways behind me"
(the holy bible, Paul, in his first letter to the Cor. 13:11)