1 2#include <iostream> 3 4using namespace std; 5 6int next() { 7 static int i = 0; 8 cout << "incrementing " << i << endl; 9 return ++i; 10} 11 12int main() { 13 int i = 0; 14 while (i < 5) 15 i = next(); 16 return 0; 17} 18