summaryrefslogtreecommitdiff
path: root/6p7.cpp
diff options
context:
space:
mode:
Diffstat (limited to '6p7.cpp')
-rw-r--r--6p7.cpp30
1 files changed, 30 insertions, 0 deletions
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 <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;
+}