control-structures/for.cc - Illustration of local variables in a for loop in C++. | Lecture 1 - slide 26 : 34 Program 3 |
#include <iostream> using namespace std; int main(){ int i = 55, j = 77; cout << i << " " << j << endl << endl; for(int j = 10, i = 0; i < 5; i++, j++){ cout << i << " " << j << endl; } cout << endl; cout << i << " " << j << endl << endl; }