[C++] 5.8 break,continue
by #독개#/*
break는 { } 를 깨고 나온다
continue 뒤를 실행시키지 않고 다시 위로올라온다
*/
#include <iostream>
int main()
{
using namespace std;
//1,2,3333333333무한
int a = 0;
while (a < 5)
{
cout << a << endl;
if (a == 3)
continue;
a++;
}
///do while이나 while 이나 continue랑쓸때 while(++a < 10); 이런식으로 넣어줘야 무한루프에 안빠진다
int count = 0;
do
{
if (count == 5)
continue;
cout << count << endl;
count++;
} while (++count < 10);
return 0;
}
🐱👓독하게 개발
'🔥 프로그래밍 학습 > C++' 카테고리의 다른 글
[C++] 5.10 std::cin 더 잘 활용하기 (0) | 2022.11.14 |
---|---|
[C++] 5.9 난수만들기 random, rand(), srand() (0) | 2022.11.14 |
[C++] 5.7 반복문 for (0) | 2022.11.14 |
[C++] 5.5 반복문 while (1) | 2022.11.14 |
[C++] 5.5 반복문 while (0) | 2022.11.14 |
블로그의 정보
독한 개발자
#독개#