# include < iostream >
using namespace std;
int get()
{
static int i = 1;
return i++;
}
int main()
{
{
cout << get() << endl;
cout << get() << endl;
cout << get() << endl;
cout << get() << endl;
cout << get() << endl;
cout << get() << endl;
cout << get() << endl;
cout << get() << endl;
cout << get() << endl;
cout << get() << endl;
cout << get() << endl;
cout << get() << get() << get() << get() << get() << endl; // output 7891010?
}
The actual output of vs2013 on windows is:
1
2
3
4
5
6
1110987
2
3
4
5
6
1110987