Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <time.h>
- #include <windows.h>
- #include <conio.h>
- #include "KeyboardControl.h"
- using namespace std;
- float balance=500;
- int random_number ()
- {
- int num;
- rand();
- num = rand()%8784;
- switch(num)
- {
- case 0 ... 615:
- {
- return 1;
- break;
- }
- case 616 ... 1231:
- {
- return 2;
- break;
- }
- case 1232 ... 1847:
- {
- return 3;
- break;
- }
- case 1848 ... 2463:
- {
- return 4;
- break;
- }
- case 2464 ... 3079:
- {
- return 5;
- break;
- }
- case 3080 ... 3695:
- {
- return 6;
- break;
- }
- case 3696 ... 4311:
- {
- return 7;
- break;
- }
- case 4312 ... 4927:
- {
- return 8;
- break;
- }
- case 4928 ... 5088:
- {
- return 0;
- break;
- }
- case 5089 ... 5704:
- {
- return 9;
- break;
- }
- case 5705 ... 6320:
- {
- return 10;
- break;
- }
- case 6321 ... 6936:
- {
- return 11;
- break;
- }
- case 6937 ... 7552:
- {
- return 12;
- break;
- }
- case 7553 ... 8168:
- {
- return 13;
- break;
- }
- case 8169 ... 8784:
- {
- return 14;
- break;
- }
- }
- }
- float color_win(float bal,int y)
- {
- int x=15;
- int bet;
- int i;
- do
- {
- cout<<"Podaj ile chcesz postawic: " ;
- cin>>bet;
- system("CLS");
- }while(bal<=bet);
- system("CLS");
- while(1)
- {
- i=0;
- char a;
- gotoxy(1,1);
- cout<<"Na co chcesz postawic"<<endl;
- gotoxy(10,10);
- cout<<"1.Czerwone"<<endl;
- gotoxy(28,10);
- cout<<"2.Zielone"<<endl;
- gotoxy(45,10);
- cout<<"3.Czarne"<<endl;
- a=getch();
- if((a==46) && (x != 49)) {
- gotoxy(x,12);
- cout << " ";
- x=x+17;
- gotoxy(x,12);
- cout << "^";
- i++;
- continue;
- }
- if((a==44) && (x != 15))
- {
- gotoxy(x,12);
- cout << " ";
- x=x-17;
- gotoxy(x,12);
- cout << "^";
- i--;
- continue;
- }
- if(a==47)
- {
- bal=bal-bet;
- if ((i==0)&&(y%2==0))
- {
- bal=bal+bet*2;
- return bal;
- }
- if ((i==2)&&(y%2==1))
- {
- bal=bal+bet*2;
- return bal;
- }
- if ((i==1)&&(y==0))
- {
- bal=bal+bet*14;
- return bal;
- }
- else
- {
- return bal;
- }
- }
- }
- }
- void roll(int num)
- {
- int time;
- boolean info=false;
- time=35;
- int ilosc=0;
- gotoxy(9,5);
- for (int j=0;j<=14;j++)
- { if(j<10) cout<<char(201)<<char(205)<<char(187)<<" ";
- if(j>=10) cout<<char(201)<<char(205)<<char(205)<<char(187)<<" ";
- }
- gotoxy(9,6);
- for(int i=0;i<=14;i++)
- {
- cout<<char(186)<<i<<char(186)<<" ";
- }
- gotoxy(9,7);
- for(int k=0;k<=14;k++)
- {
- if(k<10) cout<<char(200)<<char(205)<<char(188)<<" ";
- if(k>=10) cout<<char(200)<<char(205)<<char(205)<<char(188)<<" ";
- }
- num=14;
- while(info==false)
- {
- for(int x=0;x<=64;x++)
- {
- Sleep(time);
- gotoxy(x+9,9);
- cout<<" ^ ";
- if(x==64)
- {
- ilosc++;
- gotoxy(9+64,9);
- cout<<" ";
- x=0;
- }
- if(ilosc==1) time=75;
- if ((ilosc==1)&&(num==0)&&(x==1))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==1)&&(x==5))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==2)&&(x==9))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==3)&&(x==13))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==4)&&(x==17))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==5)&&(x==21))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==6)&&(x==25))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==7)&&(x==29))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==8)&&(x==33))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==9)&&(x==37))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==10)&&(x==41))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==11)&&(x==45))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==12)&&(x==49))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==13)&&(x==53))
- {
- time=0;
- info=true;
- break;
- }
- if ((ilosc==1)&&(num==14)&&(x==62))
- {
- time=0;
- info=true;
- break;
- }
- }
- }
- }
- int main()
- {
- srand( time( NULL ) );
- cout<<color_win(balance,random_number());
- //roll(random_number());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement