0% found this document useful (0 votes)
857 views9 pages

Casino Number Guessing Game in C

This document describes a casino number guessing game program written in C++. The program allows a player to enter their name, deposit an initial amount of money, and then make bids by guessing a random number between 1-10. If the player guesses correctly they win 10 times their bid, otherwise they lose the bid amount. The program tracks the player's remaining balance and allows them to continue playing as long as they have money left. It includes the full source code and descriptions of how the game works and rules.

Uploaded by

A- S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
857 views9 pages

Casino Number Guessing Game in C

This document describes a casino number guessing game program written in C++. The program allows a player to enter their name, deposit an initial amount of money, and then make bids by guessing a random number between 1-10. If the player guesses correctly they win 10 times their bid, otherwise they lose the bid amount. The program tracks the player's remaining balance and allows them to continue playing as long as they have money left. It includes the full source code and descriptions of how the game works and rules.

Uploaded by

A- S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Casino Number Guessing Game in C++ with Project Report |

Game

Casino Number Guessing Game in C++ with source code.


casino number guessing game project report or slot machine
programming code C++ Number Guessing program in C++ or
Casino Game in C++. Casino Games or Number Guessing
Games are both the same, in Casino, we have to guess a
number and if the number is matched with the Winning
Number or Random Number then you will win Lots of
Money. Here in the programming language, we have a
random number instead of Guessing the number in real life.

Let explanation our code step by step, First, we will take a


Username and the total amount of Money in the Deposit,
Now the player can play a Casino Game or Number Guessing
Game but before playing a game player need to Bid for every
time, Let's Take an example and try to understand the Casino
Game or Number Guessing Game.

Suppose I am a Player My Name is Ghanendra and I have a


total of 5000$ Money. I deposited My total money and Strat
playing a Casino Game or Number Guessing Game.
First I took a Bid 1000$ and guess the Number 7(Between 1
to 10) if the random number generated by the computer is 7.
So I can win 10 times My Bid amount and if I lose My
remaining Money is 4000$. Now I can play more until I have a
single penny or maybe I can Win or Maybe not.

Casino Number Guessing Game in C++


#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;

void rules();

int main()
{
string name;
int amnt;
int bidamnt;
int guess;
int dice;
char choice;

srand(time(0)); // Use for Generating Random


Number Each Time.

cout << "\


n=================================================
==============================================";
cout << "\n CCCCC A SSSSSSSSS IIIIIIIII NN NN
OOOOOOOO ";
cout << "\n CC A A SS III NN N NN OO
OO ";
cout << "\nCC A A SSSSSSSSS III NN N NN
OO OO ";
cout << "\n CC AAAAAAAA SS III NN N
NN OO OO ";
cout << "\n CCCCC A A SSSSSSSSS IIIIIIIII NN
NN OOOOOOOO ";
cout << "\
n=================================================
==============================================\n";

cout << "\nEnter Player Name: ";


getline(cin, name);

cout << "\nDeposit Your Amount: $";


cin >> amnt;

do {
system("cls");
rules();
do { cout << "\nWelcome " << name << " Are You
Ready To Play? " << "\n\n";
cout << "Enter Bid Amount: $";
cin >> bidamnt;
if (bidamnt > amnt)
cout << "You Can not Bid More Than
Current Amount\n" <<
"\nRe-enter Amount: ";
} while (bidamnt > amnt);
do { cout << "Guess The Number Between 1 To
10 :";
cin >> guess;
if (guess <= 0 || guess > 10)
cout << "\nNumber Sholud Be Between 1
To 10\n" <<
"\nGuess Numer Again: ";
} while (guess <= 0 || guess > 10);

dice = rand() % 10 + 1;

if (dice == guess)
{
cout << "\nHurray You Won " << bidamnt * 10
<< "$";
amnt = amnt + bidamnt * 10;
}
else
{
cout << "Sorry You Lose " << bidamnt << "$\n";
amnt = amnt - bidamnt;
}
cout << "\nThe Winning Number Was: " << dice <<
"\n";
cout << "\n" << name << ", Your Remaining Amount
Is " << amnt << "$\n";
if (amnt == 0)
{
cout << "\nSorry You Don't Have Money To
Play \n";
break;
}

cout << "\nYou Want To Play Again Press (y/n)? ";


cin >> choice;
} while (choice == 'Y' || choice == 'y');

cout << "\


n=================================================
==============================================\n";
cout << "Thanks For Playing Game Again Your Current
Amount Is " << amnt << "$";
cout << "\
n=================================================
==============================================\n";
return 0;
}

void rules()
{
system("cls");
cout << "\
n=================================================
==============================================\n";
cout << "\t\t\tGame Rules";
cout << "\
n=================================================
==============================================";
cout << "\n1. Choose Number Between 1 To 10";
cout << "\n2. Winning Amount Will Be 10 Times Of Bid
Amount";
cout << "\n3. Loose Amount Will Be Biding Amount";
cout << "\n4. You Can Leave A Game Any Time";
cout << "\
n=================================================
==============================================\n";
}
The Output Casino Number Guessing Game
Casino Game Code in C++

Number Guessing Game in C++

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy