Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <time.h>
- #include <stdlib.h>
- using namespace std;
- vector < int> chip;
- int dadi [3];
- void tiroDadi()
- {
- srand (time(NULL));
- for(int i=0; i<2;i++)
- {
- dadi[i]=rand()%6+1;
- }
- dadi[3]=dadi[1]+dadi[2];
- }
- void vincita(int quantita)
- {
- for(int i =0;i<quantita*2;i++)
- {
- chip.push_back(1);
- }
- }
- int main() {
- int temp;
- int puntata;
- bool verifica =true;
- bool verifica1 =true;
- string sno ="";
- cout<<"Inserire budget: ";
- cin>>temp;
- chip.resize(temp,1);
- while(verifica1)
- {
- verifica1=false;
- cout<<"Inserire puntata: ";
- cin>>puntata;
- for(int i=0;i<puntata;i++)
- {
- chip.pop_back();
- }
- if(chip.size()<=0)
- {
- cout<<"Sei in rosso";
- verifica = false;
- }
- if(verifica)
- {
- tiroDadi();
- if(dadi[3]==1||dadi[3]==4||dadi[3]==5||dadi[3]==6||dadi[3]==8||dadi[3]==9||dadi[3]==10)
- {
- cout<<"Hai perso"<<endl;
- }
- else if(dadi[3]==7||dadi[3]==11)
- {
- cout<<"Hai vinto"<<endl;
- vincita(puntata);
- }
- else if (dadi[3]==2||dadi[3]==3||dadi[3]==12)
- {
- cout<<"Puoi ritirare!"<<endl;
- while(true)
- {
- tiroDadi();
- if(dadi[3]==2||dadi[3]==3||dadi[3]==12)
- {
- cout<<"Hai vinto"<<endl;
- vincita(puntata);
- break;
- }
- else if(dadi[3]==7)
- {
- cout<<"Hai perso"<<endl;
- break;
- }
- }
- }
- }
- cout << "Il tuo budget ora e di: "<<chip.size()<<endl;
- cout<<"Vuoi continuare a rischiare?Inserisci Si per continuare, No per uscire.";
- cin>>sno;
- if(sno=="Si")
- {
- verifica1 = true;
- }
- else if (sno=="No")
- {
- cout<<"Ciao";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement