the for loop not get through..

Why my second part the "for" loop didn't get executed?

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 "../std_lib_facilities.h"
using namespace std;


//iteration exercise
int main(){
	int i=0;
	while (i<10){
		cout << i << "\t" << i*i << '\n';
		++i; //incremetal
	}
	i = 0;
	while (i<10){
		cout << i << "\t" << i*i << '\n';
		i++; //incremetal
	}
	system("pause");
	//test difference b/t ++i ,i++
	for(i=1;i<=1;i++){
		printf("i value is=",i);
		cout << i;
	}
	for(i=1;i<=1;++i){
		printf("i value is =",i);
		cout << i;
	}

}
After the second while loop, i is >= 10, so the for loops are never executed.
Topic archived. No new replies allowed.