PLEASE HELP ME CHECK THIS SOLUTION

I try to solve the problem "While ( user == gullible )", from here http://www.cplusplus.com/forum/articles/12974/

and here is my solution,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <cstdlib>

using namespace std;

int main ()
{
	int answer; int question=0;

	cout << "Guess the number i am thinking about\n";

	while (question<=10, question++)
		do {
			cout << "Insert the number other than " << question << ":";
			cin >> answer;

			if (answer==5)
				cout << "You got me babe";

			if (question==10)
				cout << "You are more patient than me, you win";
		}

		return 0;

}


but when i compile it, syntax error on return

i am sorry for this, i am only a noob :3
my question is, is there anything wrong with my solution?

Thanks :)
You're kind of combining a while loop with a do-while loop to make a while-do loop, which doesn't exist. Just remove "do" and it should work, or put the while part after the closing brace.
Umm, like this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <cstdlib>

using namespace std;

int main ()
{
	int answer; int question=0;

	cout << "Guess the number i am thinking about\n";

	while (question<=10, question++)
			cout << "Insert the number other than " << question << ":";
			cin >> answer;

			if (answer==5)
				cout << "You got me babe";

			if (question==10)
				cout << "You are more patient than me, you win";
		}

		return 0;

}
You deleted the opening brace when you deleted the "do". Put that back and it should be fine. But why are you telling them to guess any number other than the number you're incrementing, rather than 5 every time? The question seems to be telling you to always tell them to not guess 5.
lol, hahahahahaha

anyway, problem solved, i made it like this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <cstdlib>

using namespace std;

int main ()
{
	int answer; int question=0;

	cout << "Guess the number i am thinking about\n";

	
		do {
			cout << "Insert the number other than " << question++ << ":";
			cin >> answer;

			if (answer==5)
				cout << "You got me babe\n";

			if (question==10)
				cout << "You are more patient than me, you win\n";
		}  
		
		while (question!=10, answer!=5);

		return 0;

}


thanks everyone, i love you all :* THANKS !!! =)
Topic archived. No new replies allowed.