From a30d605024322ada2206d10898b8dfd6220107c1 Mon Sep 17 00:00:00 2001 From: Oskar Date: Thu, 5 Sep 2024 10:45:59 +0200 Subject: more --- 6p7.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 6p7.cpp (limited to '6p7.cpp') diff --git a/6p7.cpp b/6p7.cpp new file mode 100644 index 0000000..2c16109 --- /dev/null +++ b/6p7.cpp @@ -0,0 +1,30 @@ +#include + +/* + * + * 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; +} -- cgit v1.2.3