3605人阅读
continue的作用:使用continue语句来终止循环的当前迭代。(注意与break的区别,break会跳出循环,而continue只会跳出当前循环,而后会继续执行循环条件判断)
# include<iostream>
# include<process.h>
using namespace std;
int main(){
string word;
const int min_size = 4;
while(cin>>word){
if(word.size() < min_size)
continue;
cout<<word<<endl;
}
}//当输入的word长度小于4时不输出,大于等于四时输出
1
2
3
4
5
6
7
8
9
10
11
12
c
continue的作用
最新推荐文章于 2024-09-28 21:20:29 发布