C++

수정해야할 부분

joo_coding 2025. 5. 7. 21:49
        case 1: // 게임
        {
            cout << endl <<"게임을 시작합니다." << endl;
            cout << "기회는 총 10번입니다." << endl;

            int ball = 0;
            int strike = 0;
            vector<int>comPic = comPicNum();
            
            int chance = 0;
            while (strike!=3 && chance < 11)
            {
                if (chance > 10){
                    cout << "Loose..T.T" << endl << endl;
                    loose++;
                    break;
                }

                chance++;
                cout << endl << "~~round " << chance << "~~" << endl;
    
                vector<int>userPic = userPicNum();
                
                ball = checkBall(userPic,comPic);
                cout << "ball: " << ball << endl;
                
                strike = checkStrike(userPic,comPic);
                cout << "strike: " << strike << endl;
                
            }
            cout << "Win >.<!" << endl << endl;
            win++;

            break;
        }

기회가 초과되면 패배하고 끝나야하는데

조건문을 나가면 승리가 나옴

조건식 수정 필요함