Please help with code

Oct 25, 2011 at 2:22am
I need to create a program to display a temperature conversion chart for 0 to 100 degrees Celcius at 10 degree intervals and the corresponding Fahrenheit temperature. I'm not sure how to do Celcius at 10 degree intervals and the corresponding Fahrenheit temperature.
Last edited on Oct 27, 2011 at 2:15am
Oct 25, 2011 at 3:27am
Show us what you have so far, and we'll be glad to help you with your code. But, we can't help with something we don't see.
Oct 25, 2011 at 11:59am
this is all i have so far because i don't understand how to do a chart for 0 to 100 degrees Celcius at 10 degree intervals and the corresponding Fahrenheit temperature.

#include <cstdlib>
#include <iostream>

using namespace std;

int main()
{
double celsius;
double farenheit;

cout <<"Enter celsius temp: ";
cin >> celsius;
cout <<"Enter farenheit temp: ";
cin >> farenheit;

system("PAUSE");
return 0;
}


I know the output is supposed to look like this:

Temperature conversion chart
Celsius Fahrenheit
0-32
10-50
20-68
30-86
40-104
50-122
60-140
70-158
80-176
90-194
100-212
Last edited on Oct 25, 2011 at 12:08pm
Oct 25, 2011 at 12:46pm
@ctrygirl
I don't know why you're asking for inputs, when you say you need to do a chart conversion from 0 to 100. You need a for loop, that starts with a variable at 0 and ends with 100, with variable=+10. Then take the variable, and convert to Fahrenheit. Fahr=(((variable*9)/5)+32.0) and cout Fahr
Oct 27, 2011 at 1:16am
this is what i have come up with, I'm still not sure how to get the corresponding Fahrenheit temperature next to the celsius temp

#include <iostream>
using namespace std;

int main()
{
int celsius = 0;
int farenheit;
cout<<"Temperature Conversion Chart"<<endl;
cout<<"----------------------------"<<endl;
cout<<"Celsius \tFarenheit "<<endl;
cout<<"----------------------------"<<endl;
while (celsius <= 100)
{
cout << celsius << endl;
celsius = celsius + 10;
}

system("PAUSE");
return 0;
}
Oct 27, 2011 at 2:42am
@ctrygirl

As I mentioned in my post,
Then take the variable, and convert to Fahrenheit.
1
2
3
4
5
6
while (celsius <= 100)
{
	farenheit=(((celsius*9)/5)+32); // convert the Celsius to Fahrenheit
	cout << "   "<< celsius << "     |     " << farenheit << endl; // Output both variables on same line
	celsius = celsius + 10; // Increase Celsius by 10
}
Oct 27, 2011 at 2:53am
thank you so much for all your help i really appreciate it
Topic archived. No new replies allowed.