7章4节break和continue
来源:互联网 发布:罗马圣保罗大教堂知乎 编辑:程序博客网 时间:2024/05/18 20:48
#include <iostream>
int main ()
{
using namespace std;
typedef unsigned long ULONG;
ULONG small,large,skip,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";
// set up 2 stop conditions for the loop
while (small<large && small<MAXSMALL)
{
small++;
if(small%skip ==0) //skip the decrement?
{
cout << "skipping on " << small << endl;
continue;
}
if(large==target) //exact match for the target?
{
cout << "Target reached ";
break;
}
large-=2;
}
cout<<"/nsmall " << small << " large " << large << endl;
return 0;
}
- 7章4节break和continue
- 第五章 逃课(break和continue用法)
- break和continue区别
- break和continue
- JavaScript Break 和 Continue
- break和continue语句
- break和continue区别
- break和continue
- continue和break
- break和continue语句
- break和 continue
- break和continue
- break和continue
- continue和break区别
- break和continue关键字
- JavaScript Break 和 Continue
- JavaScript Break 和 Continue
- break和continue
- DOS下IIS服务命令
- 进程间通讯总结
- 几款流行的NET代码生成器
- 进程间通讯《一》
- 7章2节while循环
- 7章4节break和continue
- 7章4节实现dowhile
- 7章4节使用dowhile
- 7章4节用break来跳出while
- 7章5节for循环嵌套
- 7章5节for语句2个参数的循环
- 7章5节for语句的循环
- 7章5节一些荒谬的空for循环
- 7章6节for循环计算Fibonacci数