Hie!
I am totally new in c++. Few days ago i've tried to compile this source code, with Dev C++ version 4.9.9.2. But the source is failing to compile and i dont have the slightest idea of what the problem is. Below is the source code and the errors:
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;
}
Executing g++.exe...
g++.exe "C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp" -o "C:\Documents and Settings\jesualdino\My Documents\myprogram.exe" -fexceptions -g3 -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -g3
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp: In function int main(int, char**)':
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error: stray '\147' in program
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error:Enter' undeclared (first use this function)
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error: expected `;' before "the"
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error: stray '\148' in program
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:24: error: stray '\147' in program
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:24: error: Fahrenheit' undeclared (first use this function)
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:24: error: expected;' before "value"
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:24: error: stray '\148' in program
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:28: error: stray '\147' in program
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:28: error: stray '\148' in program
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:28: error: `PAUSE' undeclared (first use this function)
Execution terminated
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-10-18
The problem occurs if you use MS Word as your text editor! ;-)
Or possibly if you copy & paste the code form a electronic document that has been typeset inappropriately.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think stray 147 and 148 means you used the wrong quotes around your text. I don't know how you get those exactly but I've seen that problem on this forum before. You want to use the quotes that are ASCII 34 (0x22). Also, you should read the post titled PLEASE READ BEFORE POSTING A QUESTION because you may have some other issues (like spaces your path).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hie!
I am totally new in c++. Few days ago i've tried to compile this source code, with Dev C++ version 4.9.9.2. But the source is failing to compile and i dont have the slightest idea of what the problem is. Below is the source code and the errors:
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;
}
Executing g++.exe...
g++.exe "C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp" -o "C:\Documents and Settings\jesualdino\My Documents\myprogram.exe" -fexceptions -g3 -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -g3
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp: In function
int main(int, char**)': C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error: stray '\147' in program C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error:
Enter' undeclared (first use this function)C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error: expected `;' before "the"
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:13: error: stray '\148' in program
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:24: error: stray '\147' in program
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:24: error:
Fahrenheit' undeclared (first use this function) C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:24: error: expected
;' before "value"C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:24: error: stray '\148' in program
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:28: error: stray '\147' in program
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:28: error: stray '\148' in program
C:\Documents and Settings\jesualdino\My Documents\myprogram.cpp:28: error: `PAUSE' undeclared (first use this function)
Execution terminated
The problem occurs if you use MS Word as your text editor! ;-)
Or possibly if you copy & paste the code form a electronic document that has been typeset inappropriately.
I think stray 147 and 148 means you used the wrong quotes around your text. I don't know how you get those exactly but I've seen that problem on this forum before. You want to use the quotes that are ASCII 34 (0x22). Also, you should read the post titled PLEASE READ BEFORE POSTING A QUESTION because you may have some other issues (like spaces your path).
He's right the problems are with your qoutes when i ran the program i fixed the qoutes and it woked fine