Thursday 28 March 2013

C++ Casino Game Project

About The Project : 


Casino Game is very simple text based game designed in C++ Programming. In this game also we have not used any graphics. So this is simple project for beginners like 11th or 12th class student can learn basic project concept by my this article. In Casino Game player can deposit fund to play. From this amount he can bet on number between 1 to 12.  By winning game player will get 10 times of his fund or else will loss all fund.



Source Code : 


<pre class="brush: cpp">
#include&lt;iostream.h&gt;
#include&lt;conio.h&gt;
#include&lt;stdlib.h&gt;
#include&lt;stdio.h&gt;
#include&lt;time.h&gt;
void draw_line(int n,char ch);
void rules();
void main()
{
int balanceamt,amt,no,dice;
char playername[80],ch;
clrscr();
draw_line(60,'=');
cout&lt;&lt;"nnnnttCASINO GAMEnnnn";
draw_line(60,'=');
cout&lt;&lt;"nnnEnter Your Name :";
gets(playername);
cout&lt;&lt;"nnEnter Deposit amount to play game :";
cin&gt;&gt;balanceamt;
do
{
clrscr();
rules();
cout&lt;&lt;"nnYour current balance is Rs."&lt;&lt;balanceamt;
do
{
cout&lt;&lt;"nn"&lt;&lt;playername&lt;&lt;" enter money to bet";
cin&gt;&gt;amt;
if(amt&gt;balanceamt)
cout&lt;&lt;"Your betting amount is more than your current balancennRe-enter datan ";
else
break;
}while(1);
do
{
cout&lt;&lt;"Enter your lucky number to bet between 1 to 12 :";
cin&gt;&gt;no;
if(no&lt;=0||no&gt;12)
cout&lt;&lt;"Please check the number!! should be between 1 to 12nnRe-enter datan ";
else
break;
}while(1);
randomize();
dice=random(12)+1;
if(dice==no)
{
cout&lt;&lt;"nnGood Luck!! You won Rs."&lt;&lt;amt*10;
balanceamt=balanceamt+amt*10;
}
else
{
cout&lt;&lt;"Bad Luck this time !! You lose Rs."&lt;&lt;amt;
balanceamt=balanceamt-amt;
}
cout&lt;&lt;"nnThe winning number was : "&lt;&lt;dice;
cout&lt;&lt;"nnt"&lt;&lt;playername&lt;&lt;" You have Rs. "&lt;&lt;balanceamt&lt;&lt;endl;
cout&lt;&lt;"nn--&gt;Do you want to play (y/n)? ";
cin&gt;&gt;ch;
}while(ch=='Y'|| ch=='y');
clrscr();
cout&lt;&lt;"nnn";
draw_line(70,'+');
cout&lt;&lt;"nntTHANKS FOR COME TO CASINO YOUR BALANCE AMOUNT IS RS."&lt;&lt;balanceamt&lt;&lt;"nn";
draw_line(70,'+');
cout&lt;&lt;"nnGame developed by ANIKET RAJPUTn";
draw_line(70,'+');
getch();
}
void draw_line(int n,char ch)
{
for(int i=0;i&lt;n;i++)
cout&lt;&lt;ch;
}
void rules()
{
clrscr();
cout&lt;&lt;"nn";
draw_line(60,'-');
cout&lt;&lt;"nttRULES OF THE GAMEn";
draw_line(60,'-');
cout&lt;&lt;"nt1. Choose any number between 1 to 12nt2. If you win you will get 10 times of money you betnt3. If you bet on wrong number you will lose your betting amountnn";
draw_line(60,'-');
cout&lt;&lt;endl;
}
</pre>

4 comments:

  1. This blog is so nice to me. I will keep on coming here again and again. Visit my link as well.. 카지노사이트추천

    ReplyDelete
  2. Nice to read your article! I am looking forward to sharing your adventures and experiences. เทคนิคแทงบอลอังกฤษ

    ReplyDelete
  3. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. download aplikasi joker123

    ReplyDelete