| New to community, learning c++, need help |
[13 Sep 2003|12:53pm] |
#include
using std::cout;
using std::cin;
using std::endl;
int main() {
int start;
float fTemp;
float cTemp;
cout << "Enter 1 for F to C" << endl;
cout << "Enter 2 for C to F" << endl;
cin >> start;
switch (start) {
case 1:
cout << "Enter the Fahrenheit Temperature" << endl;
cin >> fTemp;
cTemp = (5 / 9 * fTemp) + 32;
cout << "The Celsius Temperature is " << cTemp << endl;
system ("PAUSE");
return 0;
case 2:
cout << "Enter the Celsius Temperature" << endl;
cin >> cTemp;
fTemp = (9 / 5 * cTemp) - -32;
cout << "The Fahrenheit Temperature is " << fTemp << endl;
system ("PAUSE");
return 0;
}
}
could someone tell me why the output for cTemp is always 32 and the output for fTemp is always cTemp + 32??
thanks :) (I'm fairly new to c++, any help would be much appriciated)
|
|