Skeddels
10-18-2008, 12:00 AM
What's wrong with this code and how can I fix it?
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]){
//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
//Farenheit = Celsius * (212 - 32)/100 + 32
int nCelsius;
cout << "Enter the temperature in Celsius:"; << endl;
cin >> nCelsius >> endl;
//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
//Calculate convershion factor for Celsius to Farneheit
int nFactor;
nFactor = 212 - 32
//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
//Calculate convershion factor for Farenheit to Celsius
int nFarenheit;
nFarenehit = nFactor * nCelsius/100 + 32;
//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
//Output the results
cout << "Farenheit value is:" << endl;
cin >> nFarenheit >> endl;
//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
//Keep the window open
system("PAUSE");
return 0;
}
The compiler says that there's a problem with line 10:
10 C:\Program Files\MyProjects\Test Project\main\temperature.cpp expected primary-expression before '<<' token
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]){
//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
//Farenheit = Celsius * (212 - 32)/100 + 32
int nCelsius;
cout << "Enter the temperature in Celsius:"; << endl;
cin >> nCelsius >> endl;
//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
//Calculate convershion factor for Celsius to Farneheit
int nFactor;
nFactor = 212 - 32
//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
//Calculate convershion factor for Farenheit to Celsius
int nFarenheit;
nFarenehit = nFactor * nCelsius/100 + 32;
//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
//Output the results
cout << "Farenheit value is:" << endl;
cin >> nFarenheit >> endl;
//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
//Keep the window open
system("PAUSE");
return 0;
}
The compiler says that there's a problem with line 10:
10 C:\Program Files\MyProjects\Test Project\main\temperature.cpp expected primary-expression before '<<' token