Is c++ broken or is my script?

Hey! So I have a function that checks for syntax, if you can't see any variables there, they do exist, I can guarantee. What is wrong with this code here? (I am using integers because for some reason the value of a boolean would never change.)
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
string syntax(string& a) {
	int correct = 0;
	getline(cin, a);
	int done = 0;
	cout << syntaxList[0] << endl;
	for(int i = 0; i++; i < 20 && done == 0) {
		if(syntaxList[i] == a){
			done = 1;
		} else {
			done = 0;
		}
		cout << syntaxList[i] << endl;
		if(done == 1){
			correct = 1;
		}
		cout << correct << endl;
		correct = 1;
		cout << correct << endl;
	}
	if(correct == 1){
		return "Correct syntax.";
	} else {
		cout << done << endl;
		return "Incorrect syntax!";
	}
}


Any ideas?
1. It's definitely your code that's broken.
2. How does it not work? What is it supposed to do and what does it do instead? What compiler errors do you have, if any?
It's not giving an error message. It just tells me the program breaks as soon as syntax is called. But this is solved nevertheless. Thankyou anyway.
Topic archived. No new replies allowed.