C++ Scoreboard

This is my scoreboard, I was wondering how I could place a value inside each square of the scoreboard, for example, the x value.

1
2
3
4
5
6
7
8
9
10
11
12
cout << "PLAYER SCORES" << endl;
	cout<<" 1   2\n";//displays board
	int x = 0;
	for(int a = 0; a<= 0; a++)
	{
		for(int b =0; b <= 1; b++) cout<<char(218)<<char(196)<<char(191)<<" ";
		cout<<'\n';
		for(int b =0; b <= 1; b++) cout<<char(179)<<place[a][b]<<char(179)<<" ";
		cout<<'\n';
		for(int b =0; b <= 1; b++) cout<<char(192)<<char(196)<<char(217)<<" ";
		cout<<'\n';
	}//end for statement 
I dont think anything after int x=0 will even execute. for(int a = 0; a<= 0; a++) is false off the bat.
No, the "a" loop will execute 1 time (a = 0 --> a <= 0).

The "b" loops will execute twice each. So characters 218, 196 and 191 will be printed twice, then character 179, place[a][b] and char 179 again will be printed twice. Then characters 192, 196 and 217 will be printed twice.

Not knowing what your "place" array looks like makes it difficult to figure out what's happening. Also, not knowing what your extended character set is makes it difficult to know what your "box" looks like.

However, making some assumptions--

you probably want something like:

1
2
3
4
5
6
7
8
9
for (int a = 0; a < [firstArrayDimension]; a++)
{
    for(int b = 0; b < [secondArrayDimension]; b++)
    {
        cout << char(218) << char(196) << char 191 << endl;
        cout << char(179) << place[a][b] << char(179) << endl;
        cout << char(192) << char(196) << char(217) << endl;
    }
}
Topic archived. No new replies allowed.