diff options
author | Oskar <[email protected]> | 2024-09-05 10:45:59 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-09-05 10:45:59 +0200 |
commit | a30d605024322ada2206d10898b8dfd6220107c1 (patch) | |
tree | 8dd65c678b42a84fb73bc2b69e222a0b53890b20 /6p7.cpp | |
parent | 80b6fffdf40a04ed7fa719b038ee4d5380dd3a87 (diff) |
more
Diffstat (limited to '6p7.cpp')
-rw-r--r-- | 6p7.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -0,0 +1,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; +} |