Discussion:
[Dev-C++] DEV-C++ Does Not Pause
Administrator
2002-10-10 12:28:01 UTC
Permalink
//start of code

#include <iostream.h>

int main() //Most important part of the program!

{

int age; //Need a variable...

cout<<"Please input your age: "; //Asks for age

cin>>age; //The input is put in age

if(age<100) //If the age is less than 100

{

cout<<"You are pretty young!"; //Just to show it works

}

else if(age==100) //I use else just to show an example

{

cout<<"You are old"; //Just to show you it works...

}

else

{

cout<<"You are really old"; //Executed if no other statement is executed


}

return 0;

}

//end of code

when I enter "my age" then I must press <ENTER> to run the if statements, The DOS window stays up till i press <ENTER> to process.

I cant get the movie to pause and give me the result "You are old". "You are really old" or whatever the result must be.

How can I pause the movie and process it?

I tried:

//code
system("PAUSE");
return 0;
}
//code

but this just trows an error.

Also I tried to run the EXE by itself, but again, it does the same thing

Thanks for your help
Elizabeth Barham
2002-10-10 12:44:02 UTC
Permalink
You could do another cin.
This is a multi-part message in MIME format.
------=_NextPart_000_004F_01C2703F.657C9830
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
//start of code
#include <iostream.h> =09
int main() //Most important part of the program!
{
int age; //Need a variable...
char dummy; // for pausing...
cout<<"Please input your age: "; //Asks for age
cin>>age; //The input is put in age
if(age<100) //If the age is less than 100
{
cout<<"You are pretty young!"; //Just to show it works
}
else if(age=3D=3D100) //I use else just to show an example=20
{
cout<<"You are old"; //Just to show you it works...
}
else
{
cout<<"You are really old"; //Executed if no other statement is =
executed
}
cout << "Hit enter to continue." << endl;
cin >> dummy;
return 0;
}
//end of code
-e
Rafael Charnovscki
2002-10-10 13:01:05 UTC
Permalink
Hi,
You probably have a compilation error.
system("PAUSE") needs stdlib.h (#include <stdlib.h>)

Rafael
Post by Administrator
//start of code
#include <iostream.h>
//include stdlib
#include <stdlib.h>
Post by Administrator
int main() //Most important part of the program!
{
int age; //Need a variable...
cout<<"Please input your age: "; //Asks for age
cin>>age; //The input is put in age
if(age<100) //If the age is less than 100
{
cout<<"You are pretty young!"; //Just to show it works
}
else if(age==100) //I use else just to show an example
{
cout<<"You are old"; //Just to show you it works...
}
else
{
cout<<"You are really old"; //Executed if no other statement is executed
}
return 0;
}
//end of code
when I enter "my age" then I must press <ENTER> to run the if
statements, The DOS window stays up till i press <ENTER> to process.
I cant get the movie to pause and give me the result "You are old". "You
are really old" or whatever the result must be.
How can I pause the movie and process it?
//code
system("PAUSE");
return 0;
}
//code
but this just trows an error.
Also I tried to run the EXE by itself, but again, it does the same thing
Thanks for your help
Santiago
2002-10-10 22:06:09 UTC
Permalink
just type cin.ignore(); below the cin>>age; statement

Check this link for more info:
http://www.gunn.palo-alto.ca.us/~jkleinjans/ignore.html

----- Original Message -----
From: "Rafael Charnovscki" <***@unesc.rct-sc.br>
To: "Administrator" <***@hotmail.com>
Cc: "Dev-Cpp List" <dev-cpp-***@lists.sourceforge.net>
Sent: Thursday, October 10, 2002 10:58 AM
Subject: Re: [Dev-C++] DEV-C++ Does Not Pause
Post by Rafael Charnovscki
Hi,
You probably have a compilation error.
system("PAUSE") needs stdlib.h (#include <stdlib.h>)
Rafael
Post by Administrator
//start of code
#include <iostream.h>
//include stdlib
#include <stdlib.h>
Post by Administrator
int main() //Most important part of the program!
{
int age; //Need a variable...
cout<<"Please input your age: "; //Asks for age
cin>>age; //The input is put in age
if(age<100) //If the age is less than 100
{
cout<<"You are pretty young!"; //Just to show it works
}
else if(age==100) //I use else just to show an example
{
cout<<"You are old"; //Just to show you it works...
}
else
{
cout<<"You are really old"; //Executed if no other statement is executed
}
return 0;
}
//end of code
when I enter "my age" then I must press <ENTER> to run the if
statements, The DOS window stays up till i press <ENTER> to process.
I cant get the movie to pause and give me the result "You are old". "You
are really old" or whatever the result must be.
How can I pause the movie and process it?
//code
system("PAUSE");
return 0;
}
//code
but this just trows an error.
Also I tried to run the EXE by itself, but again, it does the same thing
Thanks for your help
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dev-cpp-users mailing list
TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
Helmut G
2002-10-10 14:07:10 UTC
Permalink
yeah i needed to include:

#include <stdlib.h>

so every time i need to pause a move
i must include the

stdlib.h

and use the

system("pause");

command

thanx
Santiago Palmier Campos
2002-10-10 14:21:09 UTC
Permalink
Hi again,

You can use 'cin.ignore();' instead of 'system("pause");'.
This is a portable method also.

Regards,
Santy

PS: Maybe a C++ pedantic issue, but for C++ include style use '#include
<iostream>' instead of '#include <iostream.h>' ;o)

-----Original Message-----
From: Administrator [mailto:***@hotmail.com]
Sent: jueves, 10 de octubre de 2002 16:29
To: Dev-cpp-***@lists.sourceforge.net
Subject: [Dev-C++] DEV-C++ Does Not Pause


//start of code

#include <iostream.h>

int main() //Most important part of the program!

{

int age; //Need a variable...

cout<<"Please input your age: "; //Asks for age

cin>>age; //The input is put in age

if(age<100) //If the age is less than 100

{

cout<<"You are pretty young!"; //Just to show it works

}

else if(age==100) //I use else just to show an example

{

cout<<"You are old"; //Just to show you it works...

}

else

{

cout<<"You are really old"; //Executed if no other statement is executed


}

return 0;

}

//end of code

when I enter "my age" then I must press <ENTER> to run the if statements,
The DOS window stays up till i press <ENTER> to process.

I cant get the movie to pause and give me the result "You are old". "You are
really old" or whatever the result must be.

How can I pause the movie and process it?

I tried:

//code
system("PAUSE");
return 0;
}
//code

but this just trows an error.

Also I tried to run the EXE by itself, but again, it does the same thing

Thanks for your help

--------------------------------------------------------------------------------------
This message and any files transmitted with it are confidential and intended solely
for the use of the individual or entity to whom they are addressed. No confidentiality
or privilege is waived or lost by any wrong transmission.
If you have received this message in error, please immediately destroy it and kindly
notify the sender by reply email.
You must not, directly or indirectly, use, disclose, distribute, print, or copy any
part of this message if you are not the intended recipient. Opinions, conclusions and
other information in this message that do not relate to the official business of
Ydilo Advanced Voice Solutions, S.A. shall be understood as neither given nor endorsed by it.
--------------------------------------------------------------------------------------
Administrator
2002-10-10 14:44:06 UTC
Permalink
i needed to include =(

#include <stdlib.h>

so every time i need to pause a move
i must include the

stdlib.h

and use the

system("pause");

command

thanx
Continue reading on narkive:
Loading...