Posts

Program

Image
     Tic Tac Toe Player Vs Computer  C++ Code Using Classes First of all here is C++ code.Run on compiler and surely it will work. #include<iostream> using namespace std; class Game { private: char arr[3][3]; int a,b; public: int bary; Game() { const char a='a'; for(int i=0;i<3;i++) for(int j=0;j<3;j++) arr[i][j]=a; } void board() { cout<<"   "<<"0"<<"  "<<"1"<<"   "<<"2\n\n"; for(int i=0;i<3;i++) {cout<<i<<"  "; for(int j=0;j<3;j++) cout<<arr[i][j]<<"   "; cout<<endl<<endl; } } int draw() { int i,j; for( i=0;i<3;i++) for( j=0;j<3;j++) { if(arr[i][j]=='a') break; } if(i==3&&j==3) return 1; else return 0; } int move() { for(int i=0;i>=0;i++) if(bary==0) { cou...