Progrmming help


Just need some help. My program at the moment is below this set of instructions. I have no clue what to do next, need some help please guys.



<Your full name>’s Space Travel Company does temperature conversion from Celsius to Fahrenheit for planets.
The company has a file named “PlanetCelsius.dat” which contains the following information:
 Planet numberinteger
 Planet namestring
 Diameterinteger
 Average Temperature in Celsiusdouble
The formula for converting a temperature from Celsius to Fahrenheit is F = 9C/5 + 32 Write a C++ program that does the following:
 Read in the file, converts Celsius temperature to Fahrenheit equivalent
 Display all information to the monitor including Planet number, Planet name, Diameter, Temperature in Celsius, and Temperature in Fahrenheit
 Find the planet with the highest average temperature, output the hottest planet name and temperature in Celsius
 Find the planet with the lowest average temperature, output the coolest planet name and temperature in Celsius
 Creates an output file called “PlanetFahrenheit.dat” that contains Planet number, Planet name, Diameter and Temperature in Fahrenheit.

PlanetCelsius.dat should look like this: 1 Mercury 4878 117 2 Venus 12104 480 3 Earth 12756 14 4 Mars 6794 -63 5 Jupiter 142984 17 6 Saturn 120536 -130 7 Uranus 51118 -197 8 Neptune 49532 -200 The display should look like this: Number Planet Name Diameter Celsius Fahrenheit 1 Mercury 4878 km 117.00 242.60 //9*(117)/5 + 32
2 Venus 12104 km 480.00 896.00 //9*(480)/5 + 32
3 Earth 12756 km 14.00 … //calculate F
4 Mars 6794 km -63.00 … //calculate F
5 Jupiter 142984 km 17.00 …
6 Saturn 120536 km -130.00 …
7 Uranus 51118 km -197.00 …
8 Neptune 49532 km -200.00 -328.00 //calculate F The hottest planet is …, the temperature is … in Celsius. The coolest planet is …, the temperature is … in Celsius.
Page 3 of 3
PlanetFahrenheit.dat should look like this: 1 Mercury
4878 242.60 2
Venus
12104 896.00 … //should also include planets 3 to 7 …
8 Neptune
49532 -328.00




_______________________________________________________________________
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
using namespace std;

int main()
{
//ifs and ints
ifstream planetTemperature("PlanetCelsius.dat");
string planets;
int planetNumber;
int planetSize;
double averageCelisus, averageFahrenheit;
//end ifs and ints

//My display
cout << "Number\t\t" << "Planet Name\t"<< "Diameter\t" << "Celsius\t\t" << "Fahrenheit\t"<<endl;
cout <<"_______________________________________________________________________<<endl;
//end my display

//Check to see if file if found
while (planetTemperature >> planets)
{
cout << planets <<endl;
}
//end of file found

system ("PAUSE");
return 0;
 I've seen those characters a few times lately when school projects are posted.

Strange.

Other than that. Avoid double posting:
http://cplusplus.com/forum/general/96989/

Finally, what exactley are you stuck with?
i dont understand how to use getline to do all of my calculations and then view them. It is for a school project.
i dont understand how to use getline to do all of my calculations and then view them. It is for a school project.

Well, that's because getline won't do your calculations and it won't display them. getline is a function that you can use to read data from a file.
Topic archived. No new replies allowed.