coloured texted display

In this game, player will be given a series of numbers ( from 1 to N ) and they have to guess the order in which they appear.

Every time the player enters a sequence of numbers, they will be told whether the numbers are in the correct place or not.

The player will win the game once s/he enters the numbers in the correct order.
The above is the question i have to do. I have one problem. I can not output the results in a line next to each other.
If anyone can help I will appreciate it.

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
#include <iostream>
#include "ColoredTextDisplay.h"
using namespace std;
const int constnum = 4;//Total number of digits in answer.
int Numbers[constnum]; //Total number of digits in answer.
int Numfromuser[constnum];
void Createrandomnumbers();//prototype
void Getnumfromuser();//prototype
void Checkuseranswer();//prototype
int main()
{
	Numfromuser;
	Createrandomnumbers();
	Getnumfromuser();
	Checkuseranswer();
	system("pause");
}
void Createrandomnumbers()
{
	bool isnew;
	int randomNum;
	for (int i = 0; i < constnum; i++)
	{
		do
		{
			randomNum = rand() % 10;
			isnew = true;
			for (int j = 0; j < i; j++)
			{
				if (Numbers[j] == randomNum)
				{
					isnew = false;
					break;
				}
			}

		} while (!isnew);
	
		
		Numbers[i] = randomNum;

	}
}
void Getnumfromuser()
{
	cout << "Please guess the numbers : " << endl;
	for (int i = 0; i < constnum; i++)
	{
		cin >> Numfromuser[i];
    }
}
void Checkuseranswer()
{
	for (int i = 0; i < constnum; i++)
	{
		if (Numbers[i] != Numfromuser[i])
		{
			for (int j = 4; j < constnum; j--)
			{
				Numbers[i] = Numfromuser[j];
				DisplayWithColor("*********\n", Transparent, Green);
				
				DisplayWithColor("*   ?   *\n", Transparent, Yellow);
				
				DisplayWithColor("*********\n", Transparent, Green);
				
				ResetDisplayColor();
			}
			DisplayWithColor("*********\n", Transparent, Green);
			
			DisplayWithColor("*   X   *\n", Transparent, Red);
			
			DisplayWithColor("*********\n", Transparent, Green);
			
			ResetDisplayColor();
		}
		else
		{
			DisplayWithColor("*********\n", Transparent, Green);
			
			DisplayWithColor("*   V   *\n", Transparent, Yellow);
			
			DisplayWithColor("*********\n", Transparent, Green);
			
			ResetDisplayColor();
		}
		
		
	}
}
e.
Last edited on
Topic archived. No new replies allowed.