|
5鱼币
本帖最后由 dt3tc 于 2013-5-17 19:43 编辑
调试时总会卡在
cout<<"\nSmall:"<<small<<" Large: "<<large<<endl;
那一条语句, 不能输出large变量的值, 而且不能正常终止调试, 只能按Ctrl+Q快捷键退出
IDE: codeblocks 12.11
后半部分的调试日志- [debug]> output skip
- [debug]9>>>>>>cb_gdb:
- [debug]> next
- [debug]Single stepping until exit from function _ZNSo9_M_insertImEERSoT_,
- [debug]which has no line number information.
- [debug]127 ../../../../src/gcc-4.7.1/libgcc/unwind-sjlj.c: No such file or directory.
- [debug]_Unwind_SjLj_Register (fc=0x22fe2c) at ../../../../src/gcc-4.7.1/libgcc/unwind-sjlj.c:127
- [debug]>>>>>>cb_gdb:
- Trying to pause the running process...
- Trying to pause the running process...
- Trying to pause the running process...
复制代码 Windows 7旗舰版- #include <iostream>
- using std::cin;
- using std::cout;
- using std::endl;
- int main(){
- unsigned short small;
- unsigned long large;
- unsigned long skip;
- unsigned long target;
- const unsigned short MAXSMALL=65535;
- cout<<"Enter a small number:";
- cin>>small;//接受用户输入并给变量赋值
- cout<<"Enter a large number:";
- cin>>large;//接受用户输入并给变量赋值
- cout<<"Enter a skip number:";
- cin>>skip;//接受用户输入并给变量赋值
- cout<<"Enter a target number:";
- cin>>target;//接受用户输入并给变量赋值
- cout<<"\n";
- while (small<large&&small<MAXSMALL)
- {
- small++;
- if(small%skip==0)
- {
- cout<<"skipping on "<<small<<endl;
- continue;
- }
- if(large==target)
- {
- cout<<"Target reached!";
- break;
- }
- large-=2;
- }
- cout<<"\nSmall:"<<small<<" Large: "<<large<<endl;
- cout<<endl<<"press enter to continue";
- cin.clear();
- cin.sync();
- cin.get();
- return 0;
- }
复制代码 |
|