Programma c++?

Salve a tutti mi servirebbe la scritttura di questo giochino in c++

cioè con i <<cout, cin>> ecc.

grazie a tutti in anticipo.

Comments

  • #include "stdafx.h"

    #include <iostream>

    #include <cstdlib>

    using namespace std;

    int main()

    {

    int tot=0;

    int agg;

    int giocatore = 1;

    cout << "si parte dal primo giocatore, inserisci un numero tra 1 e 3: ";

    do

    {

    cin >> agg;

    if(agg>0 && agg<4)

    {

    tot += agg;

    if(tot<100)

    {

    giocatore==2 ? giocatore = 1 : giocatore = 2;

    cout << "totale: " << tot << endl;

    cout << "giocatore " << giocatore << ": ";

    }

    }

    else

    {

    cout << "devi inserire un numero tra 1 e 3! ritenta giocatore " << giocatore << ": ";

    }

    }while(tot<100);

    cout << "fine del gioco, vincitore: giocatore " << giocatore << ". Complimenti!";

    getchar();

    getchar();

    return 0;

    }

Sign In or Register to comment.