I need assistance in creating a tic-tac-toe game

I'm having trouble entering a number into "move": when I do that, the board does not display itself again, with the "X" of the first move on the intended square. Instead, what I'm getting is "Error!" over and over again. Is there anything I'm missing? (Please constrain yourself to the language within the code. This is for a basic high school computer science class in its sixth month.)

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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
  #include < iostream>

using namespace std;

int main() {
	char exit;
	char board[100][100];			//Define variables
	int i, j, q;
	char move;
	int player;
	//char symbol;
	//char XorO;
	bool check[10];

	for (i = 1; i <= 9; i++) {
		check[i] = false;
	}
	//Initialise the map array
	for (i = 0; i <= 1; i++) {
		for (j = 0; j <= 5; j++) {			//Top left square
			board[i][j] = ' ';

		}
	}
	for (i = 2; i == 2; i++) {
		for (j = 0; j <= 2; j++) {			//Top left square
			board[i][j] = ' ';

		}
	}
	for (i = 2; i == 2; i++) {			//Number entry
		for (j = 3; j == 3; j++) {
			board[i][j] = '1';
		}
	}
	for (i = 2; i == 2; i++) {
		for (j = 4; j <= 5; j++) {			//Top left square
			board[i][j] = ' ';

		}
	}
	for (i = 3; i <= 3; i++) {
		for (j = 0; j <= 5; j++) {			//Top left square
			board[i][j] = ' ';

		}
	}
	for (i = 0; i <= 13; i++) {			//Left vertical line
		for (j = 6; j <= 6; j++) {
			board[i][j] = '|';
		}
	}
	
		for (i = 0; i <= 1; i++) {			//Top middle square
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 2; i == 2; i++) {			//Beginning of row 2
			for (j = 7; j <= 9; j++) {
				board[i][j] = ' ';

			}
		}
		for (i = 2; i == 2; i++) {			//Number entry
			for (j = 10; j == 10; j++) {
				board[i][j] = '2';
			}
		}
		for (i = 2; i == 2; i++) {
			for (j = 11; j <= 12; j++) {			//End of row 2
				board[i][j] = ' ';

			}
		}
		for (i = 3; i <= 3; i++) {
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';

			}
		}

		for (i = 0; i <= 14; i++) {			//Right vertical line
			for (j = 13; j <= 13; j++) {
				board[i][j] = '|';
			}
		}
		for (i = 0; i <= 1; i++) {			//Top right square
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 1; i == 1; i++) {			//Top right square
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 2; i == 2; i++) {			//Beginning of row 2
			for (j = 14; j <= 15; j++) {
				board[i][j] = ' ';

			}
		}
		for (i = 2; i == 2; i++) {			//Number entry
			for (j = 16; j == 16; j++) {
				board[i][j] = '3';
			}
		}
		for (i = 2; i == 2; i++) {
			for (j = 17; j <= 19; j++) {			//End of row 2
				board[i][j] = ' ';

			}
		}
		for (i = 3; i <= 3; i++) {
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';

			}
		}

		for (i = 4; i <= 4; i++) {			//Top horizontal line
			for (j = 0; j <= 19; j++) {
				board[i][j] = '=';
			}
		}
		for (i = 5; i <= 6; i++) {
			for (j = 0; j <= 5; j++) {			//Center left square
				board[i][j] = ' ';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 0; j <= 2; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 3; j == 3; j++) {
				board[i][j] = '4';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 4; j <= 5; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 8; i == 8; i++) {
			for (j = 0; j <= 5; j++) {
				board[i][j] = ' ';
			}
		}

		for (i = 5; i <= 6; i++) {			//Center middle square
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';

			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 7; j <= 8; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 9; j == 9; j++) {
				board[i][j] = '5';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 10; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 8; i == 8; i++) {
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}

		for (i = 5; i <= 6; i++) {			//Center right square
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';

			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 14; j <= 15; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 16; j == 16; j++) {
				board[i][j] = '6';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 17; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 8; i == 8; i++) {
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 9; i <= 9; i++) {			//Bottom horizontal line
			for (j = 0; j <= 19; j++) {
				board[i][j] = '=';
			}
		}
		for (i = 10; i <= 13; i++) {			//Bottom left square
			for (j = 0; j <= 5; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 0; j <= 2; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 3; j == 3; j++) {
				board[i][j] = '7';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 4; j <= 5; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 8; i == 8; i++) {
			for (j = 0; j <= 5; j++) {
				board[i][j] = ' ';
			}
		}

		for (i = 10; i <= 12; i++) {			//Bottom middle square
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 9; j == 9; j++) {
				board[i][j] = '8';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 10; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 13; i <= 14; i++) {
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}

		for (i = 10; i <= 11; i++) {			//Bottom right square
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 14; j <= 15; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 16; j == 16; j++) {
				board[i][j] = '9';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 17; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 13; i <= 14; i++) {
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}

		//Print the map array
		for (i = 0; i < 14; i++) {
			for (j = 0; j < 20; j++) {
				cout << board[i][j];
			}
			cout << endl;
		}
		
		//Print Xs and Os
		do {
			for (q = 1; q <= 9; q++) {
				player = q % 2;
				cout << "Please enter a number between 1 and 9." << endl;
				cin >> move;

			
					if (move == 1) {
						if (player == 1) {
							board[2][3] = 'X';
						}
						else if (player == 0) {
							board[2][3] = 'O';
						}
					}
					else if (move == 2) {
						if (player == 1) {
							board[2][10] = 'X';
						}
						else if(player==0){ 
							board[2][10] = 'O'; 
						}
					}
					else if (move == 3) {
						
						if (player == 1) {
							board[2][16] = 'X';
						}
						else if (player == 0) {
							board[2][16] = 'O';
						}
					}
					else if (move == 4) {
							if (player == 1) {
							board[7][3] = 'X';
						}
						else if (player == 0) {
							board[7][3] = 'O';
						}
					}
					else if (move == 5) {
						
						if (player == 1) {
							board[7][10] = 'X';
						}
						else if (player == 0) {
							board[7][10] = 'O';
						}

					}
					else if (move == 6) {
						
						if (player == 1) {
							board[7][16] = 'X';
						}
						else if (player == 0) {
							board[7][17] = 'O';
						}
					}
					else if (move == 7) {
						
						if (player == 1) {
							board[12][3] = 'X';
						}
						else if (player == 0) {
							board[12][3] = 'O';
						}

					}
					else if (move == 8) {
						
						if (player == 1) {
							board[12][9] = 'X';
						}
						else if (player == 0) {
							board[12][9] = 'O';
						}
					}
					else if (move == 9) {
					
						if (player == 1) {
							board[12][16] = 'X';
						}
						else if (player == 0) {
							board[12][16] = 'O';
						}
					}
					else {
						cout << "Error!" << endl;
					}
				}
			/*	else if (player == 0) {

					if (move == 1) {
						board[2][3] = 'O';
					}
					else if (move == 2) {
						board[2][10] = 'O';
					}
					else if (move == 3) {
						board[2][16] = 'O';
					}
					else if (move == 4) {
						board[7][3] = 'O';
					}
					else if (move == 5) {
						board[7][9] = 'O';

					}
					else if (move == 6) {
						board[7][16] = 'O';
					}
					else if (move == 7) {
						board[12][3] = 'O';

					}
					else if (move == 8) {
						board[12][9] = 'O';
					}
					else if (move == 9) {
						board[12][16] = 'O';
					}
					else {
						cout << "Error!" << endl;
					}
				}*/


			
		} while (check[move] = true);
			for (i = 0; i < 14; i++) {
				for (j = 0; j < 20; j++) {
					cout << board[i][j];
				}
				cout << endl;

			}
		
		cout << "Please press a key and enter to exit." << endl;
		cin >> exit;
		return 0;
	}
Slow down, I know you put a lot into this, but the for loop is meant to save you work, not make it harder.

{EDIT: I guess you do know nested loops, but in the code I give in the next post I show I quick trick to make them do much more work in one go and less work on you. I still suggest this guy's C++ youtube tutorials: https://www.youtube.com/playlist?list=PLAE85DE8440AA6B83 for supplemental learning between chapters of whatever book you might have}

If the error you're getting is a compile-time error, it's because your first line #include < iostream> should not have a space after the < sign (many compilers don't like that).

If you're getting "Error!" then that's because your move variable is a char. If you look up what an ascii table is, you'll see that the number 1 entered into a char through cin is actually not equal to 1 but to '1',

1 = 1
'1' = 49

Just start checking move against the ascii char value '1', '2', '3', etc.
Last edited on
I don't know if you've gotten into writing functions, but this code will output your starting board minus the actual square contents.

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
#include <iostream>

using namespace std;

void loadEmptyBoard(char container[][17], char topLine[17], char squarePadding[17])
{
	for(int i = 0; i < 13; i ++)
	{
		for(int k = 0; k < 17; k ++)
		{
			if(i%4 == 0)
			{
				container[i][k] = topLine[k];
			}
			else
			{
				container[i][k] = squarePadding[k];
			}
		}
	}
}

int main()
{
	char board[13][17];
	char *topLine = (char*) "================\0";
	char *padding = (char*) "|    |    |    |\0";
	loadEmptyBoard(board, topLine, padding);

	for(int i = 0; i < 13; i ++)
	{
		cout << board[i];
		cout << endl;
	}
}


There are several options from here to get your values into the square, some are easier than others.
Last edited on
I do not wish to remake the program wholesale. All I need is what elements to transpose, what bracketing errors I've overlooked, etc. Smaller fixes, please.
I have 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
#include <iostream>

void cursor(int, int);

using namespace std;

int main() {
	char exit;
	char board[100][100];			//Define variables
	int i, j;
	int move;
	int player;
	char symbol;
	//char XorO;
	bool check[10];

	for (i = 1; i <= 9; i++) {
		check[i] = false;
	}
	//Initialise the map array
	for (i = 0; i <= 1; i++) {
		for (j = 0; j <= 5; j++) {			//Top left square
			board[i][j] = ' ';

		}
	}
	for (i = 2; i == 2; i++) {
		for (j = 0; j <= 2; j++) {			//Top left square
			board[i][j] = ' ';

		}
	}
	for (i = 2; i == 2; i++) {			//Number entry
		for (j = 3; j == 3; j++) {
			board[i][j] = '1';
		}
	}
	for (i = 2; i == 2; i++) {
		for (j = 4; j <= 5; j++) {			//Top left square
			board[i][j] = ' ';

		}
	}
	for (i = 3; i <= 3; i++) {
		for (j = 0; j <= 5; j++) {			//Top left square
			board[i][j] = ' ';

		}
	}
	for (i = 0; i <= 13; i++) {			//Left vertical line
		for (j = 6; j <= 6; j++) {
			board[i][j] = '|';
		}
	}
	
		for (i = 0; i <= 1; i++) {			//Top middle square
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 2; i == 2; i++) {			//Beginning of row 2
			for (j = 7; j <= 8; j++) {
				board[i][j] = ' ';

			}
		}
		for (i = 2; i == 2; i++) {			//Number entry
			for (j = 9; j == 9; j++) {
				board[i][j] = '2';
			}
		}
		for (i = 2; i == 2; i++) {
			for (j = 10; j <= 12; j++) {			//End of row 2
				board[i][j] = ' ';

			}
		}
		for (i = 3; i <= 3; i++) {
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';

			}
		}

		for (i = 0; i <= 14; i++) {			//Right vertical line
			for (j = 13; j <= 13; j++) {
				board[i][j] = '|';
			}
		}
		for (i = 0; i <= 1; i++) {			//Top right square
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 1; i == 1; i++) {			//Top right square
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 2; i == 2; i++) {			//Beginning of row 2
			for (j = 14; j <= 15; j++) {
				board[i][j] = ' ';

			}
		}
		for (i = 2; i == 2; i++) {			//Number entry
			for (j = 16; j == 16; j++) {
				board[i][j] = '3';
			}
		}
		for (i = 2; i == 2; i++) {
			for (j = 17; j <= 19; j++) {			//End of row 2
				board[i][j] = ' ';

			}
		}
		for (i = 3; i <= 3; i++) {
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';

			}
		}

		for (i = 4; i <= 4; i++) {			//Top horizontal line
			for (j = 0; j <= 19; j++) {
				board[i][j] = '=';
			}
		}
		for (i = 5; i <= 6; i++) {
			for (j = 0; j <= 5; j++) {			//Center left square
				board[i][j] = ' ';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 0; j <= 2; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 3; j == 3; j++) {
				board[i][j] = '4';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 4; j <= 5; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 8; i == 8; i++) {
			for (j = 0; j <= 5; j++) {
				board[i][j] = ' ';
			}
		}

		for (i = 5; i <= 6; i++) {			//Center middle square
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';

			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 7; j <= 8; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 9; j == 9; j++) {
				board[i][j] = '5';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 10; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 8; i == 8; i++) {
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}

		for (i = 5; i <= 6; i++) {			//Center right square
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';

			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 14; j <= 15; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 16; j == 16; j++) {
				board[i][j] = '6';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 17; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 8; i == 8; i++) {
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 9; i <= 9; i++) {			//Bottom horizontal line
			for (j = 0; j <= 19; j++) {
				board[i][j] = '=';
			}
		}
		for (i = 10; i <= 13; i++) {			//Bottom left square
			for (j = 0; j <= 5; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 0; j <= 2; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 3; j == 3; j++) {
				board[i][j] = '7';
			}
		}
		for (i = 7; i == 7; i++) {
			for (j = 4; j <= 5; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 8; i == 8; i++) {
			for (j = 0; j <= 5; j++) {
				board[i][j] = ' ';
			}
		}

		for (i = 10; i <= 12; i++) {			//Bottom middle square
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 9; j == 9; j++) {
				board[i][j] = '8';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 10; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 13; i <= 14; i++) {
			for (j = 7; j <= 12; j++) {
				board[i][j] = ' ';
			}
		}

		for (i = 10; i <= 11; i++) {			//Bottom right square
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 14; j <= 15; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 16; j == 16; j++) {
				board[i][j] = '9';
			}
		}
		for (i = 12; i == 12; i++) {
			for (j = 17; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}
		for (i = 13; i <= 14; i++) {
			for (j = 14; j <= 19; j++) {
				board[i][j] = ' ';
			}
		}

		//Print the map array
		for (i = 0; i < 14; i++) {
			for (j = 0; j < 20; j++) {
				cout << board[i][j];
			}
			cout << endl;
		}
		
		//Print Xs and Os
		do {
			for (i = 1; i <= 9; i++) {
				player = i % 2;
				cout << "Please enter a number between 1 and 9: ";
				cin >> move;

				if (player == 1) {
					symbol = 'X';
				}
				else if (player == 0) {
					symbol = 'O';
				}

if (move == 1) {
					check[move] = true;
					check[i] = true;
					board[2][3] = symbol;
					cursor(2, 3);
					cout << symbol;
					cursor(14, 0);
				}
				else if (move == 2) {
					check[move] = true;
					check[i] = true;
					board[2][9] = symbol;
					cursor(2, 9);
					cout << symbol;
					cursor(14, 0);
				}
				else if (move == 3) {
					check[move] = true;
					check[i] = true;
					board[2][16] = symbol;
					cursor(2, 16);
					cout << symbol;
					cursor(14, 0);
				}
				else if (move == 4) {
					check[move] = true;
					check[i] = true;
					board[7][3] = symbol;
					cursor(7, 3);
					cout << symbol;
					cursor(14, 0);
				}
				else if (move == 5) {
					check[move] = true;
					check[i] = true;
					board[7][9] = symbol;
					cursor(7, 9);
					cout << symbol;
					cursor(14, 0);
				}
				else if (move == 6) {
					check[move] = true;
					check[i] = true;
					board[7][16] = symbol;
					cursor(7, 16);
					cout << symbol;
					cursor(14, 0);
				}
				else if (move == 7) {
					check[move] = true;
					check[i] = true;
					board[12][3] = symbol;
					cursor(12, 3);
					cout << symbol;
					cursor(14, 0);
				}
				else if (move == 8) {
					check[move] = true;
					check[i] = true;
					board[12][9] = symbol;
					cursor(12, 9);
					cout << symbol;
					cursor(14, 0);
				}
				else if (move == 9) {
					check[move] = true;
					check[i] = true;
					board[12][16] = symbol;
					cursor(12, 16);
					cout << symbol;
					cursor(14, 0);
				}
				else {
					cout << "Error!" << endl;
				}
				
			}
		} while (check[move] = true);
	
		cout << "Please press a key and enter to exit." << endl;
		cin >> exit;
		return 0;
	}

Meanwhile, for the function "cursor":
1
2
3
4
5
6
7
8
#include "windows.h"
void cursor(int x, int y) {
	COORD cord;
	cord.X = y;
	cord.Y = x;
	SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), cord);

}
Solved.
Any thoughts?
Last edited on
Topic archived. No new replies allowed.