Code:
#include <iostream> #include <stdlib.h> #include <time.h> using namespace std; int main(){ string gamemode,pacanele="Pacanele",blackjack="Blackjack"; float i=0,credit=100,c1=0,a; cout<<"Bun venit la cazino!"<<endl; cout<<"Alege un mod de joc:"<<pacanele<<endl; cout<<blackjack;cin>>gamemode; if(gamemode==pacanele){ srand(time(0)); while(i++ < 3){ unsigned int r = (rand()%10)-1; cout<<r<<" "<<endl; credit=credit-3.33; if(i==1){ c1=1; a=r; } if(a==r&&i>1) c1++; if(c1>1&&a==r) credit=credit+10; if(c1==3) credit=credit*10; } } cout<<"Your credit is:"<<credit; int x,d,s=0,s1=0,credits1=1000; if(gamemode==blackjack){ srand((int)time(0)); while(i++ < 1){ unsigned int d = (rand()%20)+1; cout<<d<<" "<<endl; s=s+d; } while(i++ < 1){ unsigned int x = (rand()%20)+1; cout<<x<<" "<<endl; s1=s1+x; } while(i++ < 1){ unsigned int d = (rand()%20)+1; cout<<d<<" "<<endl; s=s+d; } while(i++ < 1){ unsigned int x = (rand()%20)+1; cout<<x<<" "<<endl; s1=s1+x; } while(i++ < 1){ unsigned int d = (rand()%20)+1; cout<<d<<" "<<endl; s=s+d; } while(i++ < 1){ unsigned int x = (rand()%20)+1; cout<<x<<" "<<endl; s1=s1+x; } if(s1>s) credits1=credits1+100; if(s>s1) credits1=credits1-100; } return 0; } /*basicaly i'm making a roulette and blackjack like at the casino and i need help*/
Comment