#include <iostream>
#include <time.h>
#include <string>
#include <Windows.h>
usingnamespace std;
int main()
{
int color;
int loop = 1;
int x = 4;
string color_code;
string simon;
srand(time(NULL));
cout << "simon_says" << endl;
cout << "y = yellow" << endl;
cout << "r = red" << endl;
cout << "g = green" << endl;
cout << "b = blue" << endl;
do
{
do
{
color_code.clear();
color = rand() % 4 + 1;
cout << color << endl;
switch (color)
{
case 1:
color_code = color_code + 'y';
break;
case 2:
color_code = color_code + 'r';
break;
case 3:
color_code = color_code + 'g';
break;
case 4:
color_code = color_code + 'b';
break;
}
loop = loop++;
} while (loop <= x);
cout << color_code << endl;
Sleep(3000);
cout << string(100, '\n');
cout << "what were the colors (no spaces)" << endl;
cin >> simon;
if (simon == color_code)
{
cout << "correct" << endl;
}
if (simon != color_code)
{
cout << "incorrect" << endl;
}
x = x++;
} while (simon == color_code);
return 0;
}
output
1 2 3 4 5 6 7 8 9 10 11 12
simon_says
y = yellow
r = red
g = green
b = blue
3
3
4
3
g
what were the colors (no spaces)
it should output 4 colors then if u get those 4 correct it generates 5 colors and so on. i had it so it was doing 4 colors and could tel if it was right or wrong then i added the out do while loop for if it was correct and now if only come up with one color but still has the 4 numbers. it come up with the numbers for the colors but it doesnt seem to concatenate the color codes.