Posts

A Shooting Game

Source code: #include <stdlib.h> #include <windows.h> #include <iostream> using namespace std; #define VK_A 0x41 #define VK_B 0x42 #define VK_C 0x43 #define VK_D 0x44 #define VK_E 0x45 #define VK_F 0x46 #define VK_G 0x47 #define VK_H 0x48 #define VK_I 0x49 #define VK_J 0x4A #define VK_K 0x4B #define VK_L 0x4C #define VK_M 0x4D #define VK_N 0x4E #define VK_O 0x4F #define VK_P 0x50 #define VK_Q 0x51 #define VK_R 0x52 #define VK_S 0x53 #define VK_T 0x54 #define VK_U 0x55 #define VK_V 0x56 #define VK_W 0x57 #define VK_X 0x58 #define VK_Y 0x59 #define VK_Z 0x5A struct GAMEINFO {     COORD PlayerOnePosition;     COORD PlayerTwoPosition;     COORD PlayerOneBullet;     COORD PlayerTwoBullet;     COORD PlayerOneBullet2;     COORD PlayerTwoBullet2;     COORD ZeroZero; }; HANDLE hInput, hOutput...

Maze

source code: #include #include #include "maze.h" // =============================> Maze Objects <==================== // Maze object data members: //   int _max_row; //   int _max_col; //   char _map[MAX_MAZE_DIM+1][MAX_MAZE_DIM+1]; // ============================> report_err <======================= static void report_err(const char* message) {    cout << "FATAL ERROR (Maze): " << message << endl;   exit(1); } // ========================> member functions <===================== // ========================> Constructors <================== Maze::Maze() {   *this = Maze(7,7); } Maze::Maze(int rows, int cols) {   if (rows > MAX_MAZE_DIM || cols > MAX_MAZE_DIM)     report_err("Attempted to create overly large Maze");   _max_row = rows;   _max_col = cols;   for(int row = 1; row <= rows; row++)     for(int col = 1; col <= cols; col++)...

Shuffling Cards

source code: //Shuffling Cards //by Varun Agrawal //varun.math@gmail.com #include<iostream.h> #include<conio.h> #include<graphics.h> #include<dos.h> #include<stdlib.h> #include<time.h> void swap(char [],char []); int card1[] = { 20,20 , 50,20 , 50,100 , 20,100 , 20,20 }; int card2[] = { 80,20 , 110,20 , 110,100 , 80,100 , 80,20 }; int card3[] = { 140,20 , 170,20 , 170,100 , 140,100 , 140,20 }; char val[3][2]={ "1" , "2", "3" }; void main()    {    clrscr();    char count[2]="0";    int swapnum=0;         //for number of times to swap the cards    int driver,mode;    driver=DETECT;    initgraph(&driver , &mode , "c:\tc\bgi");    setfillstyle(SOLID_FILL,YELLOW);    fillpoly(5,card1);    fillpoly(5,card2);    fillpoly(5,card3);    settextstyle(GOTHIC_FONT,HORIZ_DIR,6);    s...

Arcanoid with Mouse

Source Code: /********************** |||||||| BRICK GAME ||||||||| *************************/ #include <iostream.h> #include <conio.h> #include <ctype.h>                  //defining toupper # include <process.h>               //exit(0) # include <dos.h> # include <stdlib.h> # include <graphics.h> # include <stdio.h> # define NULL 0 # define YES 1 # define NO 0 #define ESC    0x1b            /* Define the escape key    */ int MaxX, MaxY, MidX, MidY ; int bri[5][20] ; int    GraphDriver;        /* The Graphics device driver        */ int    GraphMode;        /* The Graphics mode value ...