Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parse error?

Status
Not open for further replies.

AndBack3

Programmer
Oct 27, 2001
15
0
0
US
Hi...i'm getting many (at least 10) parse errors in my program. First of all, i have no idea what 'parse' is.

an example of code, then my error follow. I'm only including one function of the program, all parameters (variables) are properly declared and sent; the function is not overloaded


//----------------------------------------------
/*This function will print out a line of text that simulates a racetrack; pgap is the space on the left before the track, the sides of the track are ^^, the car in the track is @, and gap1 and gap2 are the amount of spaces between the car and side of the track on the left and right, respectively.
Include files currently in use:

#include <iostream.h>
#include <conio.h>
#include &quot;rando.h&quot;

note: only member fucntions from iostream are used in this function (cout)

numbers on left are line numbers; they are not included in my origional code
string literals are in red (excluding the quotes), comments in blue*/


void Printline (int pgap,int gap1,int gap2)
//gaps are all >= 0
//next line of game output
{
int loop;
/*92*/ for (loop=1,loop<=pgap,loop++)
/*93*/ cout<<&quot; &quot;;
/*94*/ cout<<&quot;^^&quot;;
/*95*/ for (loop=1,loop <= gap1,loop++)
/*96*/ cout<<&quot; &quot;;
/*97*/ cout<<&quot;@&quot;;
/*98*/ for (loop=1,loop <= gap2,loop++
/*99*/ cout<<&quot; &quot;;
/*100*/ cout<<&quot;^^&quot;<<endl;
/*101*/ }
//----------------------------------------------

the error i'm getting is
line 92 : parse error before `)'
line 95 : parse error before `for'
line 99 : parse error before `<'
line 101: parse error before `}'


any solutions?
 
Parameters in for() are separated with ';' not by ','.
 
I can see a number of errors in your code there. I think parsing is what the compiler does when it's reading (parsing?) the code. I'd ask an expert, though.
As far as your errors go:
You are using commas in the parentheses of your for argument - you should be using semi-colons. Eg:
for(i=0;i<23;i++)
also line 98 has a right parenthesis missing from the end of it.

Maybe this'll help.

Douglas
If it don't make you laugh, it ain't true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top