1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
#include "stdafx.h"
#include <string>
#include <ctime>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
void gridEasy(void);
void randomizeTheme(string theme[]);
int main()
{
string theme[16] = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p" };
int grid;
bool firstRun = true;
cout << "Please choose your grid: " << endl << endl;
cout << "1. 4 x 4 grid (Easy)" << endl;
cout << "2. 6 x 6 grid (Medium)" << endl;
cout << "3. 8 x 8 grid (Hard)" << endl << endl;
cin >> grid;
if (grid == 1)
{
return 16;
}
else if (grid == 2)
{
return 32;
}
else if (grid == 3)
{
return 64;
}
else
{
do
{
cout << "Please choose your grid: " << endl << endl;
cout << "1. 4 x 4 grid (Easy)" << endl;
cout << "2. 6 x 6 grid (Medium)" << endl;
cout << "3. 8 x 8 grid (Hard)" << endl << endl;
if (!firstRun)
{
system("CLS");
cout << "Not a correct response, please try again." << endl;
cin.clear();
cin.ignore(INT_MAX, '\n');
}
firstRun = false;
} while (!(cin >> grid));
gridEasy();
srand(time(0));
randomizeTheme(theme);
for (int i = 0; i < 16; i++)
{
cout << theme[i] << endl;
}
system("Pause");
return 0;
}
}
void gridEasy(void)
{
for (int r = 0; r < 4; r++)
{
for (int c = 0; c < 4; c++)
{
cout << "-----------------------------" << endl;
cout << "|" << setw(9) << r + 1 << setw(9) << "|" << endl;
cout << "-----------------------------" << endl;
}
}
cout << "--------------------------------------------------------------------------------";
}
void randomizeTheme(string theme[])
{
random_shuffle(theme, theme + 16);
}
|