I'm trying to read a number from a text file that is the degrees in Celsius, and then I'm supposed to calculate that number into the equivalent temperature in Fahrenheit, and the program is supposed to output both numbers--but I keep recieving a syntax error, and apparently I have a missing semicolon somewhere:
#include <iostream>
using std::cerr;
using std::cout;
using std::endl;
#include <fstream>
using std::ifstream;
#include <cstdlib>
#include <cmath>
int main()
{
ifstream indata;
int c;
int f;
indata.open("temps.txt");
if(!indata) {
cerr << "Error: file could not be opened" << endl;
exit(1);
}
indata >> c;
while ( !indata.eof() ) { // keep reading until end-of-file
cout << "The temperature in Celsius is: " << c << endl;
indata >> c; // sets EOF flag if no value found
for (int f = 9.0 / 5 * c + 32;){
cout << "The temperature in Fahrenheit is: " << f << endl;
}
}
indata.close();
cout << "End-of-file reached.." << endl;
return 0;
}