pause
how do i make my program pause? im using dev c++ and ive used these commands return 0; and system ("pause");
[108 byte] By [
tralfas] at [2007-11-11 10:31:16]

# 1 Re: pause
#include "iostream"
using namespace std;
int main()
{
float gallons;
cout << "7.481 gallons = 1 cubic foot" << endl;
cout << "Enter amount in in gallons: ";
cin >> gallons;
cout << gallons / 7.481 << "cubic feet" << endl;
system ("pause");
return 0;
}
# 2 Re: pause
its <iostream> for one thing.
and pause is a windows/dos command, so you gotta be on that platform.
try
cin.getline and press enter to "unpause" until you can determine what is wrong with the system call.
jonnin at 2007-11-11 20:59:36 >

# 4 Re: pause
I think the answer your looking for is
Sleep(1000); and those are in milliseconds i believe... not sure about what headers are supposed to be up there...
JD007 at 2007-11-11 21:01:35 >

# 5 Re: pause
if you want a fixed time pause, say 1 second, use Sleep(1000);
Otherwise, use cin>>x;
the program will pause until a key is hit.
Danny at 2007-11-11 21:02:45 >
