cout<<"to break this PAUSE, press ENTER ";
string tmp;
cin>>string;
this does not work. Why/
in C++, how to proceed by pressing just "ENTER"in C++, how to proceed by pressing just "ENTER"
Page 1 of 1
5 Replies - 11241 Views - Last Post: 28 March 2008 - 07:36 AM
Replies To: in C++, how to proceed by pressing just "ENTER"
#2
Re: in C++, how to proceed by pressing just "ENTER"
Posted 28 March 2008 - 05:00 AM
i think the reason it does that is because cin ignores any whitespace characters as input (this includes blank spaces and the newline and tab characters)
if you are looking for a way to pause you can use
if you are looking for a way to pause you can use
cin.get()
#3
Re: in C++, how to proceed by pressing just "ENTER"
Posted 28 March 2008 - 05:50 AM
i know a code in c which can do it hope it will help you:
char temp[80];//arbitary big size, no real meaning.
do{
gets(temp);
}while(strcmp(temp,"\n")!=0)
#4
Re: in C++, how to proceed by pressing just "ENTER"
Posted 28 March 2008 - 07:08 AM
I beleive the command you are looking for is:
system("pause");
If you are in visual studio this works by default. If you are doing command line stuff I think you need to include <stdio.h> or something to that extent.
system("pause");
If you are in visual studio this works by default. If you are doing command line stuff I think you need to include <stdio.h> or something to that extent.
#5
Re: in C++, how to proceed by pressing just "ENTER"
Posted 28 March 2008 - 07:15 AM
Using the system call to invoke the pause.exe is a platform dependent functionality and does not comply to standards. I'm assuming th goal here is to hold the execution window open....if so, please read the following.
http://www.dreaminco...wtopic30581.htm
http://www.dreaminco...wtopic30581.htm
#6
Re: in C++, how to proceed by pressing just "ENTER"
Posted 28 March 2008 - 07:36 AM
As far as i understood what you meant is ONLY when ENTER is pressed to continue,and that's what my loop does. if you meant wait for any input and than continue than there are many ways to do that, adn read the thread amadeus provided the link for.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|