No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Re:
Our assignment was to write a tic-tac-toe program for my programming class. It is person vs. computer and the computer makes "random" moves, even if computer is going to lose they will choose a random place to put their x or o it is all correct, now what I have … |
|
[COLOR="Red"]Poly.h[/COLOR] [code=cplusplus] #include <iostream> using namespace std; #ifndef POLY101 #define POLY101 class Poly { [B]private:[/B] int order; double *a; // Coefficient vector -- a[0], a[1], a[2], ..., a[order] // to represent a[0] + a[1]*x + a[2]*x^2 + ... public: Poly(int = 0); // Default constructor Poly(const Poly &p); // Copy … |
|
//To check if there is a win #include <iostream> #include "tictactoe.h" using namespace std; int win(char board[3][3]) { for(int i=0;i<3;i=i+1) { if ((board[0] == 'x' && board[1] == 'x' && board[2] == 'x')|| (board[0] == 'o' && board[1] == 'o'&& board [2]== 'o')) return 1; else if((board[0] == 'x' && … |