#include<iostream> using namespace std; void useStatic(){ static int x = 10; cout << "useStatic x: " << x << endl; x++; cout << "useStatic x: " << x << endl; } void main() { useStatic(); useStatic(); getchar(); }
时间: 2024-11-06 11:30:46
#include<iostream> using namespace std; void useStatic(){ static int x = 10; cout << "useStatic x: " << x << endl; x++; cout << "useStatic x: " << x << endl; } void main() { useStatic(); useStatic(); getchar(); }