Help

Posts 1–8 of 8 · Page 1 of 1
Help
#include <cstdlib>
#include <iostream>
using namespace std;

int main() {
double ctemp, ftemp;

cout << "Input a celsius temp and press ENTER: ";
cin >> ctemp;
ftemp = (ctemp * 1.8) + 32;
cout << "Fahrenheit temp is: " << ftemp;

return 0;
}
Its meant to convert Celsius temp to Fahrenheit.....but I see it works It just closes really fast.
Project1.zipattachment deleted
Add cin.get() or getch() before return 0; That way you wil need to hit a key before it closes.
Really popular one is system("pause");
Quote Originally Posted by zhaoyun333 View Post
Really popular one is system("pause");
But the problem with system ("pause") is that it's windows only. Also i heard it's less efficient than just cin.get(); etc.
Quote Originally Posted by zeco View Post
But the problem with system ("pause") is that it's windows only. Also i heard it's less efficient than just cin.get(); etc.
The problem with system("pause") is that is has to go allocate memory in your actual system, then pause everything your doing. This can add up to slower run-time in the long run.
Quote Originally Posted by m4cizpr0 View Post
The problem with system("pause") is that is has to go allocate memory in your actual system, then pause everything your doing. This can add up to slower run-time in the long run.
seems to me if you want to pause it, runtime isn't a big issue. Anyway I didn't know that. I will add it to my code from now on.
That didn't work and I had too add ";" b4 return or it would compile after i did what you said? .....mind post the code whole so I see if i am doing it right?
IT WORKED ...thx guys
Project1.zipattachment deleted · 1 downloads before removal
Posts 1–8 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?