How to get a visual output?

For my A2 computing I'm trying to design a Simon rhythm memory game, and while the basics are fairly straightforward I'm really struggling with some aspects. What I've done here is try to get the tough bit working for me - the random generation and the storage of the sequence after each round, as well as a sort of makeshift round counter. Obviously this is far from complete. If anyone could please, please lend me a hand with the code below that'd be great.

Primarily I need help with two things:
1-How do I get an output of letters in this format? It was fine before as I wasn't trying to test up to the 50 rounds code or anything, I was just going for functionality but until I design my GUI I really need a way of actually PLAYING the game. I feel like I've missed something really simple here.
2- How would I incorporate an option to press a key to restart the code from the first random number? (i.e restart the game).

Absolutely any help welcome. Thank you in advance.

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
#include <iostream>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <windows.h>

using namespace std;
int main () {

string seq = "";
string userseq = "";
char color[4];
color[0]='Y';
color[1]='G';
color[2]='R';
color[3]='B';// Obviously these represent Yellow, Green, Red, Blue.
int round;
round=1;
srand(time(NULL)); // 'True' randomness using time as a seed.
string a;

	while (round<51){


seq +=color[rand()%4];

cout << seq << flush; // **1**
cout << "\010." << flush <<'\n';



cout << "Enter " << round << " characters: ";
cin >> userseq;


if (userseq != seq){
cout << " The correct sequence was: " << seq << endl;
break;
}




if (round == 50){
cout << "50 rounds reached! Victory!";
break;
}
round++;
}


cout << " (Press c, then enter to close the program.)";

do{
	cin >> a;
	if(a == "c"){ // **2**
		return 0;
	}
}while(a != "c"); 

// **3**





}
Topic archived. No new replies allowed.