Strange while loop behavior

Okay so I have 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
int i = 0;
int lineN = 0;
string line;

ifstream qFile;
qFile.open("Questions.txt", ios::in);
cout << "Opened" << endl;
while(getline(qFile, line)) {
	++lineN;

	cout << line << endl;

	if (lineN == 1) data.qs[i].Q = line;
	if (lineN == 2) data.qs[i].A = line;
	if (lineN == 3) data.qs[i].B = line;
	if (lineN == 4) data.qs[i].C = line;
	if (lineN == 5) data.qs[i].D = line;
	if (lineN == 6) data.qs[i].ans = line;
	if (lineN == 7) {
		lineN = 0;
		++i;
	}

	cout << "After if block" << endl;
}


and for some reason, it prints the data on the line just fine, but does not run any of the if statements, or print "After if block", nor does it continue to loop. If I take out the if statements, it loops through the entire file just fine, and yes I have tried using a switch statement instead of the if's, but that did not work. Any help would be appreciated.
How did you define 'data' and its attributes?
Topic archived. No new replies allowed.