For loop not looping all the way

This code is a snippet of a larger code and i get no error when i compile it. I hav declared all my variables elsewhere. All the cout's are from me trying to find whats going on. when I do this for loop it will only do it once but i need it to go from 1 to 3.
not really sure whats going on with this loop please help!!
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
	
for (x=1; x<4; ++x){
	cout << x << " X " << endl;	
	ji = jm + x ;

	l1 = x;

	for ( i = 0 ; i<length +1 ; ++i) {

	if (jm==values[i][1] and jf==values[i][0] and l1==values[i][2]
				and l1==values[i][3]){

		conf2 = values [i][4];
		conf4 = values [i][5];	
	}
	}
		

		for ( i = 0 ; i < length + 1 ; ++i) {

	if (ji==values[i][1] and jm==values[i][0] and l1==values[i][2]
				and l1==values[i][3] ){
	
		f2 = values [i][4];
		f4 = values [i][5];	
	}
	}
		
		wmodel( model, f2, f4 , conf2, conf4, data,l);
		bay = baysum(model,data , l);
		ans[z] = pisum *exp(bay);

for (x=0;x<10;++x){
cout << model[x]<< "  mod " << endl;
}

cout << f2 << "  f2 " << endl;
cout << f4 << "  f4 " << endl;
cout << conf2 << "  conf2 " << endl;
cout << conf4 << "  conf4 " << endl;
cout << bay << "  bay" <<endl;
cout << ans[z] << "  ans" << endl;
cout << "----END LOOP----"<< endl;

++z;		
	
}
i found the problem I used x twice in the loop so it reset x
Topic archived. No new replies allowed.