代码示例如下: #include <iostream> void IntIDPrint() { int iID = 0; while(iID>=0) { if(iID%100000 == 0) std::cout<<iID<<"/n"; iID++; } std::cout<<"ID Before Max is:"<<--iID<<"/n"; std::cout<<"ID Max++ is:"<<++iID<<"/n"; } int main() { IntIDPrint(); int i; std::cin>>i; return 0; } 执行结果: ID Before Max is: 2147483647 ID Max is: -2147483648 维护ID的代码为: if (++ID<0) iID = 0;