Please help me with a number flasher memory game

whats the code for a number flash memory game in c++. i have this
#include <iostream>
#include "windows.h"
using namespace std;

int main()
{
int choice;
int numbers[20];

cout << "The Memory Game\n" << "Watch the screen for a number." << endl;
system("pause");
system("cls");

int i;
srand((unsigned)time(0));
for(int i = 0; i < 20; i++)
{
numbers[i] = (rand() % 100) + 1;
}

do
{
cout << numbers[i] ;
Sleep(200);
system("cls");

cout << "Enter the number that popped up on screen: ";
cin >> choice;

if (choice == numbers[i])
{

cout << "Good Job!!!" << endl << "The next number is: \n";
system("pause");
system("cls");

}

else
{
cout <<" The number(s) was(were): " << numbers[i] << endl;
cout << "Bye Bye!!!";
system("pause");
return 0;
}

}while(++i < 20);
{
cout << "Good Job, Your a Genuis.\n";
}
system("pause");
return 0;
}
1. use [code] tags
2. state your problems
3. http://www.cplusplus.com/forum/articles/28558/
the game only flashes one number @ a time....i need it to flash 1 then if you get it right ,,,flash 2,,,,and so on til it reaches 20 random numbers
Use code tags and I might help you, I'm done helping people that don't use code tags. Seriously it's really starting to get annoying it seems like NO ONE uses code tags anymore. >:O
Compiled it.
1 you should need to #include <ctime> to use time()
2 after your for loop i = 20 and thus numbers[i] is reading out of bounds. also, that's why it only loops once.
to the Noobie...im not sure what code tags are...im fairly new @ c++....sorry
They're the little <> icon to the left (under Format:). Select your code in the post and press that and your code will be properly formatted for viewing.
you make a mistake in do while loop you are using same variable "i" in for and in do while just change the variable in do while or assign "0" to i and then use it in do while
Charles, mine is similar to yours, only loops once though! but it compiles, whih is a whole lot better than anything I've had happen the last two programs, so, I might leave it as is. I fear if I change anything I'll get a million errors like usual.

Have you been able to force it to loop 20 times??
Topic archived. No new replies allowed.