Ive gotten started on this hw homework problem due tonight but I am completely stumped.
Prompt:
Write a program that creates three tables of temperatures in Celsius, Fahrenheit and Kelvin. The program will prompt the user to enter the starting temperature, the ending temperature and the increment between values all in Celsius for each test case. The program will then convert Celsius to Fahrenheit AND Kelvin creating a table of temperatures. Your program will generate three tables - one for each type of loop.
TEST CASE LOOP TYPE START TEMP (C) END TEMP (C) INCREMENT (C)
ONE While Loop 10 50 5
TWO Do While Loop 25 250 25
THREE For Loop 0 100 10
Fahrenheit = 9.0/5.0 * Celsius + 32.0
Kelvin = Celsius + 273.15
Here is an example of the dialog between the program and user:
Prompt: Enter a starting temperature in degrees Celsius.
User enters: 10
Prompt: Enter an ending temperature in degrees Celsius.
User enters: 50
Prompt: Enter the increment between temperatures in degrees Celsius.
User enters: 5
Example output from the third test case.
FOR LOOP
Celsius Fahrenheit Kelvin
0.00 32.00 273.15
10.00 50.00 283.15
20.00 68.00 293.15
30.00 86.00 303.15
40.00 104.00 313.15
50.00 122.00 323.15
60.00 140.00 333.15
70.00 158.00 343.15
80.00 176.00 353.15
90.00 194.00 363.15
100.00 212.00 373.15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;
int main(void)
{
double start, end, incr;
double Celsius, Fahrenheit, Kelvin;
cout << "Enter a starting temperature in degrees Celcius: " << endl;
cin >> start, Celsius;
cout << "Enter a ending temperature in degrees Celcius: " << endl;
cin >> end, Celsius;
cout << "Enter a ending temperature in degrees Celcius: " << endl;
cin >> incr, Celsius;
}
|