Elisssx / Briscola

gioco briscola
MIT License
2 stars 2 forks source link

Glitch #8

Open FLAK-ZOSO opened 2 years ago

FLAK-ZOSO commented 2 years ago

Quando si inserisce una lettera al posto di un numero il programma inizia a glitchare all'infinito, andrebbe fatto un controllo per impedirlo.

Elisssx commented 2 years ago

Chiedo ad aurora di farlo se no lo faccio io grazie per l’appunto

Il giorno sab 16 apr 2022 alle 09:30 FLAK-ZOSO @.***> ha scritto:

Assigned #8 https://github.com/Elisssx/Briscola/issues/8 to @Elisssx https://github.com/Elisssx.

— Reply to this email directly, view it on GitHub https://github.com/Elisssx/Briscola/issues/8#event-6443092139, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYVZGVIRQOUOUNEMQRVO2IDVFJUCFANCNFSM5TSAFYRQ . You are receiving this because you were assigned.Message ID: @.***>

FLAK-ZOSO commented 2 years ago

Io l'ho risolta così:

    string scelta_;
    int scelta;
    cin >> scelta_;
    if (scelta_ == "1" || scelta_ == "2" || scelta_ == "3")
        scelta = stoi(scelta_); // StoI = String TO Int
    else
        continue;

Vediamo se @Aurixx riesce a fare altrettanto.

Elisssx commented 2 years ago

Che roba è stoi vabbè comunque ho capito il ragionamento Il giorno sab 16 apr 2022 alle 14:37 FLAK-ZOSO @.***> ha scritto:

Io l'ho risolta così:

string scelta_;

int scelta;

cin >> scelta_;

if (scelta_ == "1" || scelta_ == "2" || scelta_ == "3")

    scelta = stoi(scelta_); // StoI = String TO Int

else

    continue;

Vediamo se @Aurixx https://github.com/aurixx riesce a fare altrettanto.

— Reply to this email directly, view it on GitHub https://github.com/Elisssx/Briscola/issues/8#issuecomment-1100654376, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYVZGVMKCQAX6P7QAB3MK53VFKX7VANCNFSM5TSAFYRQ . You are receiving this because you were mentioned.Message ID: @.***>

FLAK-ZOSO commented 2 years ago

stoi (membro di std, quindi funziona solo se hai fatto using namespace std o se scrivi std::stoi) è una funzione di C++ che esiste dallo standard C++11 (in altre parole dal 2011).

Serve a trasformare una stringa in un intero.

Elisssx commented 2 years ago

Ah ok ma si riesce a fare in altro modo perchè non so se la prof lo accetti o comunque non lo abbiamo fatto…

Il giorno sab 16 apr 2022 alle 14:40 FLAK-ZOSO @.***> ha scritto:

stoi (membro di std, quindi funziona solo se hai fatto using namespace std o se scrivi std::stoi) è una funzione di C++ che esiste dallo standard C++11 (in altre parole dal 2011).

Serve a trasformare una stringa in un intero.

— Reply to this email directly, view it on GitHub https://github.com/Elisssx/Briscola/issues/8#issuecomment-1100654958, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYVZGVO5PIFEMTHXTPW2ODLVFKYNRANCNFSM5TSAFYRQ . You are receiving this because you were mentioned.Message ID: @.***>

FLAK-ZOSO commented 2 years ago

Sì 😂 l'abbiamo fatto in classe, io l'ho scoperto lì.