Reputation: 393
I'm learning c++, following example trows "`Enter' undeclared (first use this function) ". I've been reading some questions in this site and it seems it has to do with not declaring functions. But I can't get it to work. Any help will be greatly appreciated.
//
// Program to convert temperature from Celsius degree
// units into Fahrenheit degree units:
// Fahrenheit = Celsius * (212 - 32)/100 + 32
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
// enter the temperature in Celsius
int celsius;
cout << “Enter the temperature in Celsius:”;
cin >> celsius;
// calculate conversion factor for Celsius
// to Fahrenheit
int factor;
factor = 212 - 32;
// use conversion factor to convert Celsius
// into Fahrenheit values
int fahrenheit;
fahrenheit = factor * celsius/100 + 32;
// output the results (followed by a NewLine)
cout << “Fahrenheit value is:”;
cout << fahrenheit << endl;
// wait until user is ready before terminating program
// to allow the user to see the program results
system(“PAUSE”);
return 0;
}
Upvotes: 0
Views: 300
Reputation: 42083
Change
cout << “Enter the temperature in Celsius:”;
to
cout << "Enter the temperature in Celsius:";
“”
and ""
are different.
Upvotes: 2
Reputation: 3324
Please use a simple text editor or an IDE. Your quotes are not correct.
cout << “Enter the temperature in Celsius:”;
should be changed to
cout << "Enter the temperature in Celsius:";
The error is thrown because the quotes are supposed to be like "
not ”
Upvotes: 3