|
3鱼币
本帖最后由 dt3tc 于 2013-5-12 09:51 编辑
Enter a small number: 2
Enter a large number: 10000
small: 2...
程序运行到一半就卡住了
请问为什么不能运行21行的while语句
- #include <iostream>
- using std::cin;
- using std::cout;
- using std::endl;
- int main()
- {
- unsigned short small;//初始化变量
- unsigned long large;//初始化变量
- const unsigned short MAXSMALL=65535;//定义常量
- cout<<"Enter a small number: ";//打印
- cin>>small;
- cout<<"Enter a large number: ";//打印
- cin>>large;
- cout<<"small: "<<small<<"...";//打印
- while ((small<large)&&(small<MAXSMALL))//假设
- {
- if(small%5000==0)//假设
- {
- cout<<".";
- small++;
- large-=2;
- }
- }
- cout<<"\nSmall: "<<small<<",large:"<<large<<endl;//打印
- cout<<endl<<"press enter to continue";//输出提示
- cin.clear();
- cin.sync();
- cin.get();
- return 0;
- }
复制代码
|
|