#includeiostream
#includecstdlib
#includectime
using namespace std;void printChoice(int num);int main(int argc, char *argv[])
{
int pChoice;
int cChoice;
int n;cout================================================================================endl;
cout (가위바위보) endl;
cout================================================================================endl;
cout다음 중 하나를 선택하세요endl;
cout1-가위, 2-바위, 3-보endlendl;
cout선택-;
cinpChoice;srand(time(NULL));
n = rand() % 3;
cChoice = n + 1;cout결과 : 컴퓨터;printChoice(cChoice);
cout - ;
cout플레이어;
printChoice(pChoice);
coutendl;
cout============================endl;
if(cChoice == pChoice){
cout 무승부endl;
}
else if ((cChoice == 1 && pChoice ==2)
||(cChoice == 2 && pChoice == 3)
||(cChoice == 3 && pChoice ==1)) {
cout 플레이어 winendl;
}
else {
cout 컴퓨터 WINendl;
}cout=====================endl;system(PAUSE);
return 0;
}void printChoice(int num){
switch(num){
case 1:
cout[가위];
break;case 2:
cout([바위]);
break;
case 3:
cout[보];
break;
}
}
여기서 컴퓨터가 이기거나 제가 이기거나 무승부 되면 계속하려면 아무키나 누르세요 이거 뜨는데이거 안뜨고 다시 처음으로 돌아가는 방법 어떻게 하나요..?
한지잠 2025.11.03
안되여.....ㅠ
보물선 2025.11.03
다시 main으로 돌아가게끔..
미투리 2025.11.03
안되네요.,..ㅎ
안토니 2025.11.03
C언어랑 같을지는 모르지만.
무승부밑에
main();을 넣어보세요..