Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication3.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- #include <random>
- #include <sstream>
- #include <conio.h>
- #include <windows.h>
- using namespace std;
- int row;
- int col;
- int i;
- int j;
- int GameArray[8][8];
- void Menu()
- {
- int Option;
- cout << endl;
- cout << "Welcome To My Game" << endl;
- cout << endl;
- cout << "Please Choose From The Following" << endl;
- cout << "Play (1)" << " " << "Quit (2)";
- cout << endl;
- cout << endl;
- do
- {
- cout << "Choice = ";
- cin >> Option;
- if (Option >= 2)
- {
- cout << endl;
- cout << "GoodBye!!!" << endl;
- cout << endl;
- exit(1);
- }
- {
- if (Option == 1)
- cout << endl;
- cout << "Good luck" << endl;
- cout << endl;
- }
- if (Option != 1 && Option != 2);
- } while (Option != 1 && Option != 2);
- }
- void GameBoard()
- {
- //load array with 1s
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- GameArray[i][j] = 1; // Works
- }
- }
- //Bomb = B
- //Mines = M
- GameArray[0][0] = 3;
- GameArray[0][7] = 3;
- GameArray[7][0] = 3;
- GameArray[7][7] = 3;
- GameArray[0][1] = 3;
- GameArray[7][3] = 3;
- GameArray[7][1] = 3;
- GameArray[7][6] = 3;
- GameArray[7][4] = 3;
- GameArray[0][6] = 3;
- //=========================================================
- //load array with 1s
- for (i = 0; i < 8; i++)
- {
- for (j = 0; j < 8; j++)
- {
- if (GameArray[i][j] == 1)
- std::cout << 'M';
- if (GameArray[i][j] == 2) // Works
- std::cout << '*';
- if (GameArray[i][j] == 3) // Works
- std::cout << 'B';
- }
- std::cout << std::endl;
- }
- std::cout << std::endl;
- std::cout << "Enter a row" << std::endl;
- std::cin >> row;
- std::cout << "Enter a column" << std::endl;
- std::cin >> col;
- std::cout << std::endl;
- if (GameArray[row][col] == 3) // Works
- {
- std::cout << "You're dead!" << std::endl;
- (GameArray[row][col] = 3);
- system("pause 10");
- }
- }
- int main()
- {
- Menu();
- GameBoard();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement