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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
#include <string>
#include <ctime>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
void gridSize(int rows, int col);
void randomizeTheme(string theme[]);
void populateArray(int rows, int col);
int grid = 6;
string easyTheme[16] = { "H", "He", "Li", "Be", "B", "C", "N", "O" };
string midTheme[36] = { "H", "He", "Li", "Be", "B", "C", "N", "O", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc" };
string hardTheme[64] = { "H", "He", "Li", "Be", "B", "C", "N", "O", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr" };
string cardValue[16] = {"0"};
int main()
{
bool firstRun = true;
cout << "How good is your Memory? Please select a difficulty level." << endl;
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) {
gridSize(4,4);
}
if (grid ==2) {
gridSize(6,6);
}
if (grid == 3) {
gridSize(8,8);
}
else
{
do
{
cout << "Please choose your speed: " << endl << endl;
cout << "1. 3 Second Intervals (Easy)" << endl;
cout << "2. 2 Second Intervals (Medium)" << endl;
cout << "3. 1 Second Intervals (Hard)" << endl << endl;
cin >> grid;
if (!firstRun)
{
system("CLS");
cout << "Not a correct response, please try again." << endl;
cin.clear();
cin.ignore(INT_MAX, '\n');
}
firstRun = false;
} while ((grid < 1) && (grid > 3));
}
cout << "Please select a column (letter) and row (#)." << endl;
cout << "Example: 1A or 2B. From left to right, top to bottom accordingly." << endl;
system("Pause");
return 0;
}
// Here is where the time should start to run.
time_t start = time(0);
double seconds_since_start = difftime( time(0), start);
// Here is where my grid should display
void gridSize(int rows, int col)
{
for (int p = 0; p < col; p++)
{
int loop = 0;
for(int p = 0; p < rows; p++) {
cout << "---- ";
if (loop == (rows-1)){
cout << endl;
loop = 0;
}
loop++;
}
for (int p = 0; p < rows; p++) {
cout << " " << hardTheme[p] << " " << setw(2) << left;
if (loop == (rows)){
cout << endl;
loop = 0;
}
loop++;
}
}
}
// Here is where my array should display and randomly pick based on the string array for the various boards
void populateArray(int rows, int col) {
srand(time(0));
randomizeTheme(hardTheme);
string theme[col][rows];
for (int p = 0; p < col; p++)
{
for(int p = 0; p < rows; p++)
{
theme[col][rows] = hardTheme[p];
}
}
for (int i = 0; i < 16; i++)
{
cout << theme[i] << endl;
}
}
void randomizeTheme(string theme[])
{
random_shuffle(theme, theme + 16);
}
|