Tic Tac Toe

Hello,

I am trying to make a tic tac toe game and i need some help. Here is the code i have so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
using namespace std;

int table []={1, 2, 3, 4, 5, 6, 7, 8, 9};
char x;
char o;
int n=0;
int r=0;


int main() {
	int t=5;

	for (t; t>=0; --t) {
	cout<< "|1|2|3|" << endl;
	cout<< "You are X. Enter the space you want to play one"<< endl; 
		cin>> n;
	cout<<"|1|"<< endl<< "|2|"<< endl<< "|3|"<< endl;
	cout<< "Enter the row you want to play one" << endl;
		cin>> r;

	delete table [r*n]; 
	}


I am having trouble with this line:

delete table [r*n];

What I want to do is remove that spot so the player can not access that spot in a later move, but I will need it later so I do not want to delete it. I hope this makes sense and any help would b appreciated. Thanks!
You can't just remove elements from an array like that. Why not have a nine element array that, instead of storing useless integers, stores what character is current there? (X, O, or nothing.)
Topic archived. No new replies allowed.