| | |
Parse error, syntax error, Forbids declaration
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2004
Posts: 2
Reputation:
Solved Threads: 0
undefinedundefinedundefined
I am needing help on a problem I began a few days ago. It regards a temperature prblem and I am required to write a program to display and print the degrees in farenheit and centigrade. I performed the program numerous times and got these results:
conversion.cpp:11: parse error before `const'
conversion.cpp:25: syntax error before `<'
conversion.cpp:26: syntax error before `>'
conversion.cpp:28: syntax error before `<'
conversion.cpp:29: syntax error before `>'
conversion.cpp:32: ANSI C++ forbids declaration `centiG' with no type
conversion.cpp:32: redefinition of `int centiG'
conversion.cpp:22: `int centiG' previously declared here
conversion.cpp:32: `faren' was not declared in this scope
conversion.cpp:32: `DEGREES' was not declared in this scope
conversion.cpp:33: parse error before `<'
conversion.cpp:35: ANSI C++ forbids declaration `faren' with no type
conversion.cpp:35: `DEGREES' was not declared in this scope
conversion.cpp:36: no match for `int & * _IO_ostream_withassign &'
conversion.cpp:36: parse error before `<'
conversion.cpp:47: syntax error before `{'
This is my program:
//Program 3: Conversion
//Written by: ineedhelp2004
//Date: 06/05/2004
//Course: CSCI 221
//Description: Convert and print temperatures converting Farenheit to
// Centigrade and Centigrade to Farenheit
#include <iostream.h>
#include <iomanip.h>
const float CONVERSION_FACTOR=100.0/180.0
const float FRACTION= 180.0/100.0
const int DEGREES= 32
//Prototype Declarations
float FARENHEIT (float num_1)
float CENTIGRADE (float num_2)
int main (void)
{
//Local Declarations
int faren;
int centiG;
//Statements
cout<< "Enter the Temperature in Centigrade: ";
cin >> centiG;
cout<< "Enter the Temperature in Farenheit: "<<faren<<endl;
cin >> faren;
centiG= CONVERSION_FACTOR* (faren-DEGREES)
cout<<"\nTemperature in Farenheit is: "<<faren;
faren= DEGREES+centiG * FRACTION
cout<<"\nMeasurement in Centigrade is: "<<centiG;
return 0 ;
} //main
//=========================FARENHEIT========================
//Determine the temperature in Farenheit.
float FARENHEIT (centiG)
{
//Statements
faren=DEGREES+centiG*FRACTION
return;
} // FARENHEIT
==========================CENTIGRADE==========================
//Determine centigrade
float CENTIGRADE (faren)
{
//Statements
faren=DEGREES+(centiG*FRACTION)
return;
} //CENTIGRADE
I am new at C++
Can someone please help me??
Thank you
ineedhelp2004
I am needing help on a problem I began a few days ago. It regards a temperature prblem and I am required to write a program to display and print the degrees in farenheit and centigrade. I performed the program numerous times and got these results:
conversion.cpp:11: parse error before `const'
conversion.cpp:25: syntax error before `<'
conversion.cpp:26: syntax error before `>'
conversion.cpp:28: syntax error before `<'
conversion.cpp:29: syntax error before `>'
conversion.cpp:32: ANSI C++ forbids declaration `centiG' with no type
conversion.cpp:32: redefinition of `int centiG'
conversion.cpp:22: `int centiG' previously declared here
conversion.cpp:32: `faren' was not declared in this scope
conversion.cpp:32: `DEGREES' was not declared in this scope
conversion.cpp:33: parse error before `<'
conversion.cpp:35: ANSI C++ forbids declaration `faren' with no type
conversion.cpp:35: `DEGREES' was not declared in this scope
conversion.cpp:36: no match for `int & * _IO_ostream_withassign &'
conversion.cpp:36: parse error before `<'
conversion.cpp:47: syntax error before `{'
This is my program:
//Program 3: Conversion
//Written by: ineedhelp2004
//Date: 06/05/2004
//Course: CSCI 221
//Description: Convert and print temperatures converting Farenheit to
// Centigrade and Centigrade to Farenheit
#include <iostream.h>
#include <iomanip.h>
const float CONVERSION_FACTOR=100.0/180.0
const float FRACTION= 180.0/100.0
const int DEGREES= 32
//Prototype Declarations
float FARENHEIT (float num_1)
float CENTIGRADE (float num_2)
int main (void)
{
//Local Declarations
int faren;
int centiG;
//Statements
cout<< "Enter the Temperature in Centigrade: ";
cin >> centiG;
cout<< "Enter the Temperature in Farenheit: "<<faren<<endl;
cin >> faren;
centiG= CONVERSION_FACTOR* (faren-DEGREES)
cout<<"\nTemperature in Farenheit is: "<<faren;
faren= DEGREES+centiG * FRACTION
cout<<"\nMeasurement in Centigrade is: "<<centiG;
return 0 ;
} //main
//=========================FARENHEIT========================
//Determine the temperature in Farenheit.
float FARENHEIT (centiG)
{
//Statements
faren=DEGREES+centiG*FRACTION
return;
} // FARENHEIT
==========================CENTIGRADE==========================
//Determine centigrade
float CENTIGRADE (faren)
{
//Statements
faren=DEGREES+(centiG*FRACTION)
return;
} //CENTIGRADE
I am new at C++
Can someone please help me??
Thank you
ineedhelp2004
•
•
•
•
Originally Posted by kc0arf
You also forgot the ; after all of the const's in your program.
Christian
What ever you do in C++ all line have to end with a ; except in a few cases like loops,if elses etc.
•
•
Join Date: Jun 2004
Posts: 10
Reputation:
Solved Threads: 2
Hello my Friend;
i edit your programe and it is working well;
but i notice that the average of this board member are very poor
you must read any book before beginnig to programming
here are you a good book
c++ How to Program
Dietel
There is another thing i notice the using of c old-style libraries
you must use <iostream> instead of <iostream.h>
and so on
i edit your programe and it is working well;
but i notice that the average of this board member are very poor
you must read any book before beginnig to programming
here are you a good book
c++ How to Program
Dietel
There is another thing i notice the using of c old-style libraries
you must use <iostream> instead of <iostream.h>
and so on
•
•
Join Date: Jun 2004
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by abu_sager
Hello my Friend;
i edit your programe and it is working well;
but i notice that the average of this board member are very poor
you must read any book before beginnig to programming
here are you a good book
c++ How to Program
Dietel
There is another thing i notice the using of c old-style libraries
you must use <iostream> instead of <iostream.h>
and so on
hi guys .. how r u ? all
not all members here r poor but they r just beginners and we should learn them as we can okay just step by step don't think that all people like you .. if you learn you must speard ur knowledge.. i am sorry if i wasd rude
not all members here r poor but they r just beginners and we should learn them as we can okay just step by step don't think that all people like you .. if you learn you must speard ur knowledge.. i am sorry if i wasd rude
Real Eyes Realize Real Lies
My Resume
My Resume
![]() |
Similar Threads
- PLEASE HELP .. Parse error: syntax error, unexpected T_PRIVATE, expecting ']' (PHP)
- Parse error: syntax error, unexpected $end in (PHP)
- Parse error: syntax error, unexpected $end (PHP)
- Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' (PHP)
- emergency please help fo Parse error: syntax error, unexpected T_STRING (PHP)
- Parse error: syntax error, unexpected T_STRING in c:/.......... (PHP)
- Help Needed Parse error: syntax error (PHP)
Other Threads in the C++ Forum
- Previous Thread: Enhancing a Text based RPG
- Next Thread: practice(newbie)
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math memory multiple news node number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






