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");
Originally Posted by zhaoyun333
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.
Originally Posted by zeco
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.
Originally Posted by m4cizpr0
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