"...Press any key to continue..."How do I get rid of that?
Page 1 of 1
13 Replies - 3321 Views - Last Post: 09 July 2008 - 01:49 AM
#1
"...Press any key to continue..."
Posted 06 July 2008 - 11:17 AM
To some of you this may seem a bit trivial, but as I understand it, C++ and coding in general is supposed to do what YOU want, at least most of the time. And, I'd just like to know what I can do to get rid of that in my source file.
And if you can tell me how to put a space in between that and my statement, that would be helpful in case that I want that to show up.
Replies To: "...Press any key to continue..."
#2
Re: "...Press any key to continue..."
Posted 06 July 2008 - 11:23 AM
You can get rid of that, and try any number of ways of Holding the Execution Window Open
Try that link, it's pretty helpful and I'm sure will answer all of your questions regarding this matter.
Just a quick note, try to avoid the system() function wherever possible. It takes a lot of processing compared to using something more simple such as getch(); or cin.get();
Hope this helps
#3
Re: "...Press any key to continue..."
Posted 06 July 2008 - 11:30 AM
#4
Re: "...Press any key to continue..."
Posted 06 July 2008 - 11:59 AM
this pauses the screen without the little message.
But like gabehabe said there are other better ways of pausing the screen. I was taught using the system function though so it's what I'm used to. Gotta get rid of my bad habits...
This post has been edited by tortillaboy05: 06 July 2008 - 12:02 PM
#5
Re: "...Press any key to continue..."
Posted 06 July 2008 - 05:09 PM
#6
Re: "...Press any key to continue..."
Posted 07 July 2008 - 08:59 PM
#7
Re: "...Press any key to continue..."
Posted 08 July 2008 - 05:38 AM
#8
Re: "...Press any key to continue..."
Posted 08 July 2008 - 05:44 AM
Use something like cin.get();
#9
Re: "...Press any key to continue..."
Posted 08 July 2008 - 05:58 AM
gabehabe, on 8 Jul, 2008 - 05:44 AM, said:
Use something like cin.get();
No not at all, I suppose my choice of words for this was a bit poor, I meant to say that in a Visual Studio application it will pause automatically without the system("pause"); end. Sorry for any confusion I may have caused.
This post has been edited by captainhampton: 08 July 2008 - 05:58 AM
#10
Re: "...Press any key to continue..."
Posted 08 July 2008 - 09:44 AM
#11
Re: "...Press any key to continue..."
Posted 08 July 2008 - 04:40 PM
P.S. cin.get(); doesn't work for me. I have no clue why -- the compiler seems to ignore it.
#12
Re: "...Press any key to continue..."
Posted 08 July 2008 - 07:28 PM
Ogre, on 6 Jul, 2008 - 01:17 PM, said:
This program shows you how to put lines after the last statement, so there is one empty line between your statement and "press any key to continue..." in case you ever want to use it.
Either use endl without quotes or use \n within quotes. Or you can use both, like so:
#include<iostream>
using namespace std;
int main()
{
//test
cout<<"Welcome to the game.\n"<<endl;
system("Pause");
return 0;
}
yep that's an entire program, lol.
\n is the newline character and if I remember right, endl stands for end line.
#13
Re: "...Press any key to continue..."
Posted 08 July 2008 - 11:20 PM
#14
Re: "...Press any key to continue..."
Posted 09 July 2008 - 01:49 AM
try ur getch();
|
|

New Topic/Question
Reply




MultiQuote













|