Recently I decided to start trying to teach myself C++ and picked up the C++ version of For Dummies to begin at the beginning. However the code that is given in the first chapter doesn't seem to compile when I enter it using C++ Express. The code is as follows:
And once that is entered in I get a long string of errors at the bottom of the compiler:Code:// // 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; }
Is there something that I am entering wrong or did I create the project wrong in C++ Express. (File->New->Project->Win32 Console App->Empty Project)Code:1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(14) : error C2065: '“Enter' : undeclared identifier 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(14) : error C2146: syntax error : missing ';' before identifier 'the' 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(14) : error C2065: 'the' : undeclared identifier 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(14) : error C2146: syntax error : missing ';' before identifier 'temperature' 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(14) : error C2065: 'temperature' : undeclared identifier 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(14) : error C2146: syntax error : missing ';' before identifier 'in' 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(14) : error C2065: 'in' : undeclared identifier 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(14) : error C2146: syntax error : missing ';' before identifier 'Celsius' 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(14) : error C2065: '”' : undeclared identifier 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(28) : error C2065: '“Fahrenheit' : undeclared identifier 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(28) : error C2146: syntax error : missing ';' before identifier 'value' 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(28) : error C2065: 'value' : undeclared identifier 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(28) : error C2146: syntax error : missing ';' before identifier 'is' 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(28) : error C2065: '”' : undeclared identifier 1>c:\users\kitty mcevil\documents\visual studio 2008\projects\pro\pro\code.cpp(33) : error C2065: '“PAUSE”' : undeclared identifier
Any help would be greatly appreciated, thanks![]()



LinkBack URL
About LinkBacks




