mardi 26 mai 2020

(C++) Error: ‘else’ without a previous ‘if’

new to coding in c++, and i dont understand where the error is? I've been trying to solve this for almost 2 hours, and i have no clue whats wrong.

    actions:{
            string act;
            cout<<"Hit, stand, surr?";
            cin>>act;{
            if (act == "hit"){
                if (hold == 4){cout<<"Cant hit anymore, you have max amount of cards in your hand. "; goto actions;}
                else{sum += card_v;goto start_cards;}}
            else if (act == "stand"){cout<<"pick up";}{
                    if (sum == 21){
                        ggwp:
                        cout<<"You got black jack! Congrats, you won. Another one?"; string ress; cin>>ress;{
                            if (ress == "no"){cout<<"cya later lad";goto end;}
                            else if (ress == "yes"){goto start;}
                            else{cout<<"Pardon?";goto ggwp;}}}
                    else if (sum > 21){
                        scrub:
                    cout<<"You lost, another one?";cin>>res2;
                        if (res2 == "no"){cout<<"Cya around!";goto end;}
                        else if (res2 == "yes"){goto start;}
                        else{cout<<"Hmm? I didnt hear you. "; goto scrub;}}
                    else (sum < 21);{x=rand()%21+2;}}
                        if (sum <= x){cout<<"Dealer has "<<x<<", and you lost. Continue?";cin>>res2;goto scrub;}
                        else{cout<<"You won! Continue?";};{cin>>res3;}{
                            if (res3 == "no"){cout<<"Cya later! "; goto end;}
                            else if (res3 == "yes"){goto start;}
                            else {cout<<"Speak up, kid! ";}}}
            else if (act == "surr"){cout<<"gg wp"; goto end;}
            else{cout<<"Wrong aciton name! "; goto actions;}}
end:{cout<<"bruh";}}

Aucun commentaire:

Enregistrer un commentaire