|  |
| |
| clockmaker |
cin 이나 클래스를 쓰면 C++이죠;;
if문들 여러 개를 통째로 while(1)에 넣어놓고
각각의 실행에 break;를 추가해주시면 됩니다.
0일 경우 1,2,3이 아니니 다시 while을 돌겠죠. |
2011/06/11 |
|
| profreez |
bool bQuit = false;
while(bQuit == false)
cin>>input;
if (input==1){ while(cin>>input && input !=0) s.insert(input);
}
if (input==2){ while(cin>>input && input !=0) s.remove(input);
}
if (input==3){ s.print();
}
if(input == 4)
bQuit = true;
}
이런식이면 위로 갈수 있지 않을까요? |
2011/06/11 |
|
| 늅늅 |
C언어인줄 알고 클릭했다가
C++길래 다시 나가는 늅늅.. |
2011/06/12 |
|
| stares |
추천할만한것은 아니지만..
정 모르시겟다면 goto문을 사용하는것도 .. |
2011/06/12 |
|
| 영원한공부 |
그리고 비교연산자를 == 만 사용하신다면 switch문 쓰는게 더 깔끔해 보여요.
switch(input)
{
case 1:
while(cin>>input && input !=0) s.insert(input);
break;
case 2:
while(cin>>input && input !=0) s.remove(input);
break;
case 3:
s.print();
break;
}
이게 더 나은듯 |
2011/06/12 |
|
| 메버리키 |
전 전부다 while(1) 안에 while(a!=3) 안에넣어버리고 프린트함수 에다가 bbrreeaakk;;넣어서 해결했어요.. |
2011/06/13 |
|