Paste
Pasted as C++ by registered user xujiayu ( 4 years ago )
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <stdlib.h>
#include <time.h>
int main()
{
printf("\n....................GAME BAU CUA CA..................\n");
printf("\n1.bau");
printf("\n2.cua");
printf("\n3.ca");
printf("\n4.ga");
printf("\n5.cop");
printf("\n6.tom");
printf("\n...................chuc ban dat nhieu trung nhieu...........\n");
int datcuoc = 0;
int datcuoc1 = 0;
int datcuoc2 = 0;
int datcuoc3 = 0;
int datcuoc4 = 0;
int datcuoc5 = 0;
int luachon;
int luachon1;
int luachon2;
int luachon3;
int luachon4;
int luachon5;
int sotiencuakhach = 100000;
int soducuaquykhach;
soducuaquykhach = sotiencuakhach - datcuoc - datcuoc1 - datcuoc2 - datcuoc3 - datcuoc4 - datcuoc5;
printf("\nso du cua quykhach : %d",soducuaquykhach);
while (true)
{
printf("\nHay nhap vao so ban muon lua chon: ");
scanf("%d",&luachon);
if (luachon == 0)
{
printf("\nBan da cuoc xong chuc ban may man!");
break;
}
if ( luachon == 1)
{
do
{
printf("\nBan muon cuoc BAU bao nhieu tien? : ");
scanf("%d",&datcuoc);
if(datcuoc < 10000 || datcuoc > 1000000)
{
printf("\nxin hay nhap lai, tien cuoc toi thieu 10000 toi da 1000000 cam on! ");
}
} while (datcuoc < 10000 || datcuoc > 1000000);
soducuaquykhach = sotiencuakhach - datcuoc;
printf("\nso du cua quy khach con : %d",soducuaquykhach);
if(soducuaquykhach < 0)
{
printf("\ntai khoan quy khach khong du de thuc hien cuoc nay, xin hay nap tien cam on!");
}
}
else if (luachon == 2)
{
do
{
printf("\nBan muon cuoc CUA bao nhieu tien?: ");
scanf("%d",&datcuoc1);
if(datcuoc1 < 10000 || datcuoc >1000000)
{
printf("\nso tien khong hop le tien cuoc toi thieu 10000 toi da 1000000 xin hay nhap lai cam on!");
}
} while (datcuoc1 < 10000 || datcuoc >1000000);
soducuaquykhach = sotiencuakhach - datcuoc - datcuoc1;
printf("\nso du cua quy khach con : %d",soducuaquykhach);
if(soducuaquykhach < 0)
{
printf("\ntai khoan quy khach khong du de thuc hien cuoc nay, xin hay nap tien cam on!");
}
}
else if (luachon == 3)
{
do
{
printf("\nBan muon cuoc CA bao nhieu tien? : ");
scanf("%d",&datcuoc2);
if(datcuoc2 < 10000 || datcuoc >1000000)
{
printf("\nso tien khong hop le tien cuoc toi thieu 10000 toi da 1000000 xin hay nhap lai cam on!");
}
} while(datcuoc2 < 10000 || datcuoc >1000000);
soducuaquykhach = sotiencuakhach - datcuoc - datcuoc1 - datcuoc2;
printf("\nso du cua quy khach con : %d",soducuaquykhach);
if(soducuaquykhach < 0)
{
printf("\ntai khoan quy khach khong du de thuc hien cuoc nay, xin hay nap tien cam on!");
}
}
else if (luachon == 4)
{
do
{
printf("\nBan muon cuoc GA bao nhieu tien? : ");
scanf("%d",&datcuoc3);
if(datcuoc3 < 10000 || datcuoc >1000000)
{
printf("\nso tien khong hop le tien cuoc toi thieu 10000 toi da 1000000 xin hay nhap lai cam on!");
}
} while (datcuoc3 < 10000 || datcuoc >1000000);
soducuaquykhach = sotiencuakhach - datcuoc - datcuoc1 - datcuoc2 - datcuoc3;
printf("\nso du cua quy khach con : %d",soducuaquykhach);
if(soducuaquykhach < 0)
{
printf("\ntai khoan quy khach khong du de thuc hien cuoc nay, xin hay nap tien cam on!");
}
}
else if (luachon == 5)
{
do
{
printf("\nBan muon cuoc COP bao nhieu tien? : ");
scanf("%d",&datcuoc4);
if(datcuoc4 < 10000 || datcuoc >1000000)
{
printf("\nso tien khong hop le tien cuoc toi thieu 10000 toi da 1000000 xin hay nhap lai cam on!");
}
} while (datcuoc4 < 10000 || datcuoc >1000000);
soducuaquykhach = sotiencuakhach - datcuoc - datcuoc1 - datcuoc2 - datcuoc3 - datcuoc4;
printf("\nso du cua quy khach con : %d",soducuaquykhach);
if(soducuaquykhach < 0)
{
printf("\ntai khoan quy khach khong du de thuc hien cuoc nay, xin hay nap tien cam on!");
}
}
else if (luachon == 6)
{
do
{
printf("\nBan muon cuoc TOM bao nhieu tien? : ");
scanf("%d",&datcuoc5);
if(datcuoc5 < 10000 || datcuoc >1000000)
{
printf("\nso tien khong hop le tien cuoc toi thieu 10000 toi da 1000000 xin hay nhap lai cam on!");
}
} while (datcuoc5 < 10000 || datcuoc >1000000);
soducuaquykhach = sotiencuakhach - datcuoc - datcuoc1 - datcuoc2 - datcuoc3 - datcuoc4 - datcuoc5;
printf("\nso du cua quy khach con : %d",soducuaquykhach);
if(soducuaquykhach < 0)
{
printf("\ntai khoan quy khach khong du de thuc hien cuoc nay, xin hay nap tien cam on!");
}
}
}
int xucxac; //RADOM KET QUA
printf("\nLOADING");
Sleep(200);
printf(".");
Sleep(200);
printf(".");
Sleep(200);
printf(".");
printf("\n\tMO THUONG LAN THU 1 LOADING");
Sleep(1000);
printf(".");
Sleep(1000);
printf(".");
Sleep(1000);
printf(".");
srand(time(0));
xucxac = 1 + rand()%6;
if (xucxac == 1)
{
printf("\nket qua lan quay thu 1 la BAU");
}
else if (xucxac == 2)
{
printf("\nket qua lan quay thu 1 la CUA");
}
else if (xucxac == 3)
{
printf("\nket qua lan quay thu 1 la CA");
}
else if (xucxac == 4)
{
printf("\nket qua lan quay thu 1 la GA");
}
else if (xucxac == 5)
{
printf("\nket qua lan quay thu 1 la COP");
}
else if (xucxac == 6)
{
printf("\nket qua lan quay thu 1 la TOM");
}
int xucxac1;
printf("\n\tMO THUONG LAN THU 2 LOADING");
Sleep(1000);
printf(".");
Sleep(1000);
printf(".");
Sleep(1000);
printf(".");
srand(time(0));
xucxac1 = 1 + rand()%6;
if (xucxac1 == 1)
{
printf("\nket qua lan quay thu 2 la BAU");
}
else if (xucxac1 == 2)
{
printf("\nket qua lan quay thu 2 la CUA");
}
else if (xucxac1 == 3)
{
printf("\nket qua lan quay thu 2 la CA");
}
else if (xucxac1 == 4)
{
printf("\nket qua lan quay thu 2 la GA");
}
else if (xucxac1 == 5)
{
printf("\nket qua lan quay thu 2 la COP");
}
else if (xucxac1 == 6)
{
printf("\nket qua lan quay thu 2 la TOM");
}
int xucxac2;
printf("\n\tMO THUONG LAN THU 3 LOADING");
Sleep(1000);
printf(".");
Sleep(1000);
printf(".");
Sleep(1000);
printf(".");
srand(time(0));
xucxac2 = 1 + rand()%6;
if (xucxac2 == 1)
{
printf("\nket qua lan quay thu 3 la BAU");
}
else if (xucxac2 == 2)
{
printf("\nket qua lan quay thu 3 la CUA");
}
else if (xucxac2 == 3)
{
printf("\nket qua lan quay thu 3 la CA");
}
else if (xucxac2 == 4)
{
printf("\nket qua lan quay thu 3 la GA");
}
else if (xucxac2 == 5)
{
printf("\nket qua lan quay thu 3 la COP");
}
else if (xucxac2 == 6)
{
printf("\nket qua lan quay thu 3 la TOM");
}
//kiem tra ket qua
getch();
return 0;
}
Revise this Paste