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
|
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <conio.h>
#include <windows.h>
#include <winable.h>
using namespace std;
int main()
{
int y;
char guess[200];
char series[200] = {};
char red[10] = {"red "};
char blue[10] = {"blue "};
char green[10] = {"green "};
char yellow[10] = {"yellow "};
int colorseries[100] = {4 ,1 ,2 ,2 ,2 ,3 ,3 ,4 ,1 ,1 ,3 ,3 ,1 ,2 ,4 ,1 ,2 ,2 ,3 ,1 ,1 ,2 ,4 ,2 ,4 ,2 ,4 ,4 ,3 ,2 ,2 ,2 ,1 ,4 ,1 ,1 ,4 ,4 ,4 ,2 ,1 ,3 ,3 ,3 ,1 ,1 ,3 ,2 ,3 ,2 ,2 ,1 ,1 ,1 ,3 ,2 ,2 ,2 ,4 ,3 ,3 ,3 ,4 ,1 ,2 ,1 ,1 ,3 ,4 ,4 ,4 ,1 ,2 ,4 ,2 ,2 ,4 ,4 ,4 ,2 ,2 ,4 ,3 ,3 ,4 ,4 ,2 ,2 ,4 ,3 ,2 ,3 ,1 ,3 ,4 ,3 ,3 ,4 ,3};
//Color strings as well as series string
srand(time(0));
int a =rand() % 75 + 1;
//Random variable is made called color
int start;
// Start button
cout<<"Welcome To Simon Says! Press any key to receive your first color.\n";
for (int x = 0; x >= 0; x++)
{
y = 0;
getch();
BlockInput(y == 1);
(a = a + 1);
int *p;
(p = &colorseries[a]);
switch (*p) {
case 1:
strcat(series,red);
break;
case 2:
strcat(series,blue);
break;
case 3:
strcat(series,green);
break;
case 4:
strcat(series,yellow);
break;
}
cout<<"The series is: "<<series<<"\n";
Sleep(1700 + (x * 250));
system("CLS");
cout<<"Enter your guess for the series:\n";
(y = 1);
cin>>guess;
system("CLS");
cout<<"Press any key to recieve another color\n";
if(strcmp( series, guess)> 0, strcmp(series,guess)< 0) {
cout<<"Game Over\nYou Guessed "<<x<<" Colors Correctly";
break;
}
}
}
|