Tic tac toe

Mar 20, 2013 at 2:45pm
I'm making a tic tac toe function that has a computer as the x (first player) and then the user as the o (second player). So far my code is:
#include <iostream>
#include <cmath>
#include <fstream>

using namespace std;

void nextMove()
{

}
void printBoard()
{
char board[3][3];
cout << board;
}
int main()
{
char o;
nextMove;
printBoard;
checkWin;
cout << "Please enter coordinates for your move: " << endl;
cin >> o

return 0;
}
In the function void nextMove I need to create a random number generator to put the x token on the array. I looked it up but didn't find much and I cant find the section in my book, also should I be using float for the o declaration to input coordinates?
Mar 20, 2013 at 7:45pm
Use code tags for posting your code, makes it much easier to read.

And if you need to the function for the generator look at this link: http://www.cplusplus.com/reference/cstdlib/rand/

You will also need to seed it for more random result, both under the <cstdlib> library.
Topic archived. No new replies allowed.