A simple Zombie War Game in C++

Here I’ve shared a basic Zombie War Game in C++, it is a very simple game and understand the code will definitely help you learn C++. Just go through the code, it is pretty self explanatory.  Program for Zombie War Game in C++: #include <iostream> #include <stdlib.h> #include <unistd.h> #include <time.h> using namespace std; int … Read more

Casino Game C++: Simple Number Guessing

A Simple Casino Game C++:


  • This is a Number Guessing Game.
  • Player deposits an initial amount to start playing game.
  • He guess a number between 1 to 10 and enters betting amount.
  • If he wins he will get 10 times of money he bets.
  • If he bets on wrong number he will lost his betting amount.
  • Game continues till user wants to play.


casino game c++ 1

casino game c++


#include <iostream>
#include <string> // Needed to use strings
#include <cstdlib> // Needed to use random numbers
#include <ctime>
using namespace std;

void drawLine(int n, char symbol);
void rules();

int main()
    string playerName;
    int amount; // hold player's balance amount
    int bettingAmount;
    int guess;
    int dice; // hold computer generated number
    char choice;

    srand(time(0)); // "Seed" the random generator

    cout << "nnnttCASINO GAMEnnnn";

    cout << "nnEnter Your Name : ";
    getline(cin, playerName);

    cout << "nnEnter Deposit amount to play game : $";
    cin >> amount;

        cout << "nnYour current balance is $ " << amount << "n";

        // Get player's betting amount
            cout <<playerName<<", enter money to bet : $";
            cin >> bettingAmount;
            if(bettingAmount > amount)
                cout << "Your betting amount is more than your current balancen"
                       <<"nRe-enter datan ";
        }while(bettingAmount > amount);

        // Get player's numbers
            cout << "Guess your number to bet between 1 to 10 :";
            cin >> guess;
            if(guess <= 0 || guess > 10)
                cout << "Please check the number!! should be between 1 to 10n"
                    <<"nRe-enter datan ";
        }while(guess <= 0 || guess > 10);

        dice = rand()%10 + 1; // Will hold the randomly generated integer between 1 and 10

        if(dice == guess)
            cout << "nnGood Luck!! You won Rs." << bettingAmount * 10;
            amount = amount + bettingAmount * 10;
            cout << "Bad Luck this time !! You lost $ "<< bettingAmount <<"n";
            amount = amount - bettingAmount;

        cout << "nThe winning number was : " << dice <<"n";
        cout << "n"<<playerName<<", You have $ " << amount << "n";
        if(amount == 0)
            cout << "You have no money to play ";
        cout << "nn-->Do you want to play again (y/n)? ";
        cin >> choice;
    }while(choice =='Y'|| choice=='y');

    cout << "nnn";
    cout << "nnThanks for playing game. Your balance amount is $ " << amount << "nn";

    return 0;

void drawLine(int n, char symbol)
    for(int i=0; i<n; i++)
        cout << symbol;
    cout << "n" ;

void rules()
    cout << "nn";
    cout << "ttRULES OF THE GAMEn";
    cout << "t1. Choose any number between 1 to 10n";
    cout << "t2. If you win you will get 10 times of money you betn";
    cout << "t3. If you bet on wrong number you will lose your betting amountnn";

Please tell if you have any query or any suggestion.

Console Shooting Game C++

Very simple game executed successfully on DEV-C++ 5.6.3 It has 11 levels you can try, every level the speed and the amount of “birds” is increasing.The controls are arrow keys for moving and 1 / 2 for shooting. Best Console Shooting Game C++  CODE: #include <iostream> #include <conio.h> #include <windows.h> #include <ctime> #include <vector> class game … Read more

Hangman Game C++

It is a simple project just to provide a Hang Man game concept.In this project I haven’t draw a man for a wrong choice so,try to draw a simple man by using “|” pattern in your project which make your project better . Here is the source code ,copy and compile it in Code::blocks gcc … Read more

Snake and Ladder Game C++

This code implements the classic Snake and Ladder game C++. It can be played by two players.   This program is compiled with Turbo C++, you can download it from here Turbo C++   PROGRAM to implement Snake and Ladder Game in C++: #include<stdio.h> #include<graphics.h> #include<conio.h> #include<malloc.h> #include<stdlib.h> #include<dos.h> #include<iostream.h> int k=1, i, user=0, dice=0, … Read more

Tetris game’s easy implementation in C++

Following is program to implement Tetris Game C++, this is simple code created using <graphics.h>   This program is compiled and executed in Turbo C++   C++ Program to implement Tetris Game: // Program in C++ to implement Tetris Game. #include <conio.h> #include <graphics.h> #include <dos.h> #include <stdlib.h> #include <process.h> #include <time.h> int score=0; void … Read more