Hi there. I am currently working on this assignment and am currently lost. I would appreciate anyone help me get to the right direction.
Math equations for the temperatures:
Kelvin - F = (K - 273.15) * 1.8000 + 32
Celsius - F = C * 9/5 + 32
Newton - F = N * 60 / 11 + 32
Required:
You are not allowed to use a do-while loop for this program.
Use a while loop in conjunction with a switch statement. Please review the information on primed loops.
You must prime your loop with input from the keyboard before the while loop starts.
The program should continue converting temperatures until X is entered as a conversion type.
The output look something like this:
This temperature conversion program converts other temperature types to Fahrenheit.
The temperature types are:
C - Celsius
K - Kelvin
N - Newton
X - eXit
To use the converter, you must input a value and one of the temperature types.
For example, 32 C converts 32 degrees from Celsius to Fahrenheit
Please enter a value and its type to be converted
38 C
38C is 100.4 in Fahrenheit.
Please enter a value and its type to be converted
100 K
100K is -279.67 in Fahrenheit
Please enter a value and its type to be converted
0 X
Press any key to continue . . .
This is my code so far.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
#include <iostream>
using namespace std;
int main()
{
char temp;
double value;
cout << "This temperature conversion program converts other temperature types to Fahrenheit" << endl;
cout << "The temperature types are: \nC - Celsius\nK - Kelvin\nN - Nexon\nX - eXit" << endl << endl;
cout << "To use this converter, you must input a value and one of the temperature types." << endl;
cout << "For example, 32 C converts to 32 degrees from Celsius to Fahrenheit" << endl << endl;
cout << "Please enter a value and its type to be converted" << endl;
cin >> value;
cin >> temp;
while(temp != X)
return 0;
}
|