[Error] expected ';' before 'people'

Currently I am working on an exercise called "Pancake Glutton" (Source: http://www.cplusplus.com/forum/articles/12974/).

I'm fine with working everything out but when compiled the error,
" [Error] expected ';' before 'people' " is given to the lines below (When the bold area is removed the program works fine.)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
		 for (int count3 =10; count3 >> 0; count3--)
		{
			if (people[check] >> store[X])
			{
			 X++;
	     	}	 
			else if (store[X] = people[check])
			{
			 store[X] = store[X++]
			 people[check] = store[X--]
		    }
		    else if (store[X] >> people[check])
			{
			 store[X] = store[X++]
			 people[check] = store[X--]
		    }
			 
		}


I have played around with this section of code for quite a while and still can't find the area ";" is required to be in.

If anybody needs all of the code I'll edit it in.

Thanks in advance :D
You are forgetting ; on the ends of your statements on most of those bolded lines.
That was my first thought, I have tried ending all of them in almost every order though.

EDIT: Just tried something totally different and it works now :D
Last edited on
You need semicolons after each statement

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 for (int count3 =10; count3 >> 0; count3--)
		{
			if (people[check] >> store[X])
			{
			 X++;
	     	}	 
			else if (store[X] = people[check])
			{
			 store[X] = store[X++];
			 people[check] = store[X--];
		    }
		    else if (store[X] >> people[check])
			{
			 store[X] = store[X++];
			 people[check] = store[X--];
		    }
			 
		} 


I'm guessing you want to use the equal to operator instead of the assignment operator of the assignment operator and > instead of the a bitshift operator in lines 7 and 12

http://www.cplusplus.com/doc/tutorial/operators/

Also in this article look at the increment and decrement operators (++ and --), specifically the difference between prefix and postfix.
Last edited on
Thanks but I solved it :)
Topic archived. No new replies allowed.