summaryrefslogtreecommitdiff
path: root/6p7.cpp
blob: 2c16109ac6c6cd30a8d61324511bf9776c705419 (plain)
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
#include <iostream>

/*
 *
 * 6.7
 *
 *
 */

int ThisFunctionHasAStaticVariable() {

	static int i = -1;
	++i;
	return i;
}

int main () {
	
	std::cout << ThisFunctionHasAStaticVariable() << std::endl;
	std::cout << ThisFunctionHasAStaticVariable() << std::endl;
	std::cout << ThisFunctionHasAStaticVariable() << std::endl;
	std::cout << ThisFunctionHasAStaticVariable() << std::endl;
	std::cout << ThisFunctionHasAStaticVariable() << std::endl;
	std::cout << ThisFunctionHasAStaticVariable() << std::endl;
	std::cout << ThisFunctionHasAStaticVariable() << std::endl;
	std::cout << ThisFunctionHasAStaticVariable() << std::endl;
	std::cout << ThisFunctionHasAStaticVariable() << std::endl;
	std::cout << ThisFunctionHasAStaticVariable() << std::endl;
	return 0;
}