Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 135,941 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,715 people online right now. Registration is fast and FREE... Join Now!




Error in showing

 
Reply to this topicStart new topic

Error in showing

quaresma
18 May, 2008 - 08:37 AM
Post #1

New D.I.C Head
*

Joined: 5 May, 2008
Posts: 19

i made a code of [X-O]
i made a 2D array of type character in game level 1 only
i wanted to show what is saved in the memory of the array

CODE

// FCI - Year 1 - Programming 1 - Course Project
// Team Name: The Champions
// Program Name: X-O game.cpp
// Last Modification Date:    xx/xx/xxxx
// Author: Mohamed Ahmed Mostafa    ID: 20070244
// Author: Mohamed Hossam Eldeen    ID: 20070252
// Author: Omar Mohsen Elgohary     ID: 20070410
// Author: Assim abdelmenaem Tolba  ID: 20070408
// Purpose: A game to be played either by 2 players





#include<iostream>
#include<string>
#include<fstream>
#include<iomanip>
using namespace std;


struct highscore // structure to have the name and score of each player
{
       string name;
       int score;
};
// End of the Structure


// Function to add the name and score for player in the level played
void append (string file, string target , int s)
{
     highscore y;
     y.name=target;
     y.score=s;
     ofstream x;
     x.open((file.c_str()),ios::app);
     x<<y.name<<y.score;
     x.close();
}
// End of the function


// Function to check the player's name wheter found before or not
// If found update his score
// If not found create a new score for him
void check_player_name(string file, string target , int s)
{
int i=0;
ofstream q;
ifstream r;
r.open((file.c_str()));
highscore b[10];
while (r.is_open() && !r.eof())
{
      r>> b[i].name >> b[i].score;
      i++;
}

r.close();
for(i=0;i<10;i++)
{
                 if (target.compare(b[i].name) == 0)
                 break;
}
if ( i == 10)
   append (file , target , s);
else
   {
       q.open((file.c_str()));
       b[i].score<<s;
  
   for (int j=0; j<10; j++)
   {
       q << b[j].name <<b[j].score;
   }
q.close();
}
}
// End of the function


void game_level_2(int &check2)
{
     string high_scores_level_2 = "high_scores_level_2";
     string name1;
     string name2;
     int score1=0;
     int score2=0;
     int check =0;
     int r , c,w,z;
     cout<<" Player 1 will sign ' x ' while player 2 will sign ' o '"<<endl<<endl;
     int x[4][4];
     for (int j=0; j<4; j++)
    {
        cout<< setw(6)<<"l"<<setw(6)<<"l"<<setw(6)<<"l";
        cout<<endl;
        for (int i=0; i<4; i++)
        cout<<setw(5)<<" ____";
        cout<<endl;
    }
    for (z=0; z<16; z++)
    {
    cout<<" Player 1: enter first the number of the row then number of cloumb"<<endl;
    cout<<" to mark your sign";
    cin>>r>>c;
    if (x[r][c] == 1 || x[r][c] == 2)
    cout<<" Wrong cell to put your sign please enter in another cell"<<endl;
    else
    {
        x[r][c]=1;
     if (x[0][0] ==1 && x[0][1] ==1 && x[0][2] == 1 && x[0][3]== 1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[1][0] ==1 && x[1][1] ==1 && x[1][2] == 1 && x[1][3]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[2][0] ==1 && x[2][1] ==1 && x[2][2] == 1 && x[2][3]==1 )
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
      else if (x[3][0] ==1 && x[3][1] ==1 && x[3][2] == 1 && x[3][3]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][0] ==1 && x[1][1] ==1 && x[2][2] == 1 && x[3][3]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][3] ==1 && x[1][2] ==1 && x[2][1] == 1 && x[3][0]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][0] ==1 && x[1][0] ==1 && x[2][0] == 1 && x[3][0]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][1] ==1 && x[1][1] ==1 && x[2][1] == 1 && x[3][1]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][2] ==1 && x[1][2] ==1 && x[2][2] == 1 && x[3][2]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
      else if (x[0][3] ==1 && x[1][3] ==1 && x[2][3] == 1 && x[3][3]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     }
    
    
    cout<< " Now player 2 enter the number of row then coloumb"<<endl;
    cin>>r>>c;
    if (x[r][c] == 1 || x[r][c] == 2)
    cout<<" Wrong cell to put your sign please enter in another cell"<<endl;
    else
    {
        x[r][c]=2;
     if (x[0][0] ==2 && x[0][1] ==2 && x[0][2] == 2 && x[0][3] ==2)
    {
                 cout<<"player 2 wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     else if (x[1][0] ==2 && x[1][1] ==2 && x[1][2] == 2 && x[1][3]==2)  
    {
                 cout<<"player 2 wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     else if (x[2][0] ==2 && x[2][1] ==2 && x[2][2] == 2 && x[2][3]==2)
    {
                 cout<<"player 2 wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
      else if (x[3][0] ==2 && x[3][1] ==2 && x[3][2] == 2 && x[3][3]== 2)
    {
                 cout<<"player 2 wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     else if (x[0][0] ==2 && x[1][1] ==2 && x[2][2] == 2 && x[3][3]==2)
    {
                 cout<<"player 2 wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     else if (x[0][3] ==2 && x[1][2] ==2 && x[2][1] == 2 && x[3][0]==2)
    {
                 cout<<"player 2 wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     else if (x[0][0] ==2 && x[1][0] ==2 && x[2][0] == 2 && x[3][0]==2)
    {
                 cout<<"player 2 wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     else if (x[0][1] ==2 && x[1][1] ==2 && x[2][1] ==2 && x[3][1]==2)
    {
                 cout<<"player 2 wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     else if (x[0][2] ==2 && x[1][2] ==2 && x[2][2] ==2 && x[3][2]==2)
    {
                 cout<<"player 2 wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
      else if (x[0][3] ==2 && x[1][3] ==2 && x[2][3] ==2 && x[3][3]==2)
    {
                 cout<<"player 2 wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     }
}
   if (check == 0)
   {
             cout<<" drow !!!"<<endl;
             cout<<" if you want to play again press 1"<<endl;
             cout<<" if you want to display high score press 2"<<endl;
             cout<<" if you want to exit press 3"<<endl;
             cin>> check2;  
   }
    else if (check ==1)
   {
        cout<<" Player 1 your score increased"<<endl;
        cout<<" Please enter your name"<<endl;
        cin>> name1;
        check_player_name(high_scores_level_2 ,name1 ,score1);
        cout<<" if you want to play again press 1"<<endl;
        cout<<" if you want to display high score press 2"<<endl;
        cout<<" if you want to exit press 3"<<endl;
        cin>> check2;
   }
   else if (check ==2)
   {
        cout<<" Player 2 your score increased"<<endl;
        cout<<" Please enter your name"<<endl;
        cin>> name2;
        check_player_name(high_scores_level_2 , name2  , score2);
        cout<<" if you want to play again press 1"<<endl;
        cout<<" if you want to display high score press 2"<<endl;
        cout<<" if you want to exit press 3"<<endl;
        cin>> check2;
   }
                
  
}

void game_level_1(int &check2, string &name1, string &name2)
{
     string high_scores_level_1 = "high_scores_level_1";
     int score1=0;
     int score2=0;
     int check =0;
     int r , c,w,z;
     cout<<name1<<" your sign is ' x ' while "<<name2<<" your sign is ' o '"<<endl<<endl;
     char x[3][3];
     for (int j=0; j<3; j++)
    {
        cout<< setw(5)<<"I"<<setw(5)<<"I"<<setw(5)<<"l";
        cout<<endl;
        for (int i=0; i<3; i++)
        cout<<setw(4)<<" ____";
        cout<<endl;
    }
    for (z=0; z<9; z++)
    {
    cout<<name1<<": enter first the number of the row then number of cloumb"<<endl;
    cout<<" to mark your sign"<<endl;
    cin>>r>>c;
    if (x[r][c] == 'X' || x[r][c] == 'X')
    cout<<" Wrong cell to put your sign please enter in another cell"<<endl;
    else
    {
        x[r][c]='X';
        for (int g=0; g<3; g++)
        {
            for (int h=0; h<3; h++)
            cout<<x[g][h];
        }
     if (x[0][0] =='X' && x[0][1] =='X' && x[0][2] =='X')
    {
                 cout<<name1<<" wins"<<endl;
                 score1++;
                 check = 1;
                 break;
     }
     else if (x[1][0] ==1 && x[1][1] ==1 && x[1][2] == 1)
    {
                 cout<<name1<<" wins"<<endl;
                 score1++;
                 check = 1;
                 break;
     }
     else if (x[2][0] ==1 && x[2][1] ==1 && x[2][2] == 1)
    {
                 cout<<name1<<" wins"<<endl;
                 score1++;
                 check = 1;
                 break;
     }
     else if (x[0][0] ==1 && x[1][1] ==1 && x[2][2] == 1)
    {
                 cout<<name1<<" wins"<<endl;
                 score1++;
                 check = 1;
                 break;
     }
     else if (x[0][2] ==1 && x[1][1] ==1 && x[2][0] == 1)
    {
                 cout<<name1<<" wins"<<endl;
                 score1++;
                 check = 1;
                 break;
     }
     else if (x[0][0] ==1 && x[1][0] ==1 && x[2][0] == 1)
    {
                 cout<<name1<<" wins"<<endl;
                 score1++;
                 check = 1;
                 break;
     }
     else if (x[0][1] ==1 && x[1][1] ==1 && x[2][1] == 1)
    {
                 cout<<name1<<" wins"<<endl;
                 score1++;
                 check = 1;
                 break;
     }
     else if (x[0][2] ==1 && x[1][2] ==1 && x[2][2] == 1)
    {
                 cout<<name1<<" wins"<<endl;
                 score1++;
                 check = 1;
                 break;
     }
     }
    
    
    cout<<name2<<" : enter the number of row then coloumb"<<endl;
    cin>>r>>c;
    if (x[r][c] == 1 || x[r][c] == 2)
    cout<<" Wrong cell to put your sign please enter in another cell"<<endl;
    else
    {
          x[r][c]='O';
        for (int g=0; g<3; g++)
        {
            for (int h=0; h<3; h++)
            cout<<x[g][h];
        }
     if (x[0][0] ==2 && x[0][1] ==2 && x[0][2] == 2)
    {
                 cout<<name2<<" wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     else if (x[1][0] ==2 && x[1][1] ==2 && x[1][2] == 2)
    {
                 cout<<name2<<" wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     else if (x[2][0] ==2 && x[2][1] ==2 && x[2][2] == 2)
    {
                 cout<<name2<<" wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     else if (x[0][0] ==2 && x[1][1] ==2 && x[2][2] == 2)
    {
                 cout<<name2<<" wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     else if (x[0][2] ==2 && x[1][1] ==2 && x[2][0] == 2)
    {
                 cout<<name2<<" wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     else if (x[0][0] ==2 && x[1][0] ==2 && x[2][0] == 2)
    {
                 cout<<name2<<" wins"<<endl;
                 score2+=1;
                 check = 2;
                 break;
     }
     else if (x[0][1] ==2 && x[1][1] ==2 && x[2][1] ==2)
    {
                 cout<<name2<<" wins"<<endl;
                 score2++;
                 check = 2;
                 break;
     }
     else if (x[0][2] ==2 && x[1][2] ==2 && x[2][2] ==2)
    {
                 cout<<name2<<" wins"<<endl;
                 score2++;
                 check = 2;
                 break;
     }
     }
}
   if (check == 0)
   {
             cout<<" drow !!!"<<endl;
             cout<<" if you want to play again press 1"<<endl;
             cout<<" if you want to display high score press 2"<<endl;
             cout<<" if you want to exit press 3"<<endl;
             cin>> check2;  
   }
   else if (check ==1)
   {
        cout<<name1<<" your score increased"<<endl;
        check_player_name(high_scores_level_1 ,name1 ,score1);
        cout<<" if you want to play again press 1"<<endl;
        cout<<" if you want to display high score press 2"<<endl;
        cout<<" if you want to exit press 3"<<endl;
        cin>> check2;
   }
   else if (check ==2)
   {
        cout<<name2<<" your score increased"<<endl;
        check_player_name(high_scores_level_1 , name2  , score1);
        cout<<" if you want to play again press 1"<<endl;
        cout<<" if you want to display high score press 2"<<endl;
        cout<<" if you want to exit press 3"<<endl;
        cin>> check2;
   }
}

void game_level_3(int &check2)
{
     string high_scores_level_3 = "high_scores_level_3";
     string name1;
     string name2;
     int score1=0;
     int score2=0;
     int check =0;
     int r , c,w,z;
     cout<<" Player 1 will sign ' x ' while player 2 will sign ' o '"<<endl<<endl;
     int x[5][5];
     for (int j=0; j<5; j++)
    {
        cout<< setw(7)<<"l"<<setw(7)<<"l"<<setw(7)<<"l";
        cout<<endl;
        for (int i=0; i<5; i++)
        cout<<setw(6)<<" ____";
        cout<<endl;
    }
    for (z=0; z<25; z++)
    {
    cout<<" Player 1: enter first the number of the row then number of cloumb"<<endl;
    cout<<" to mark your sign";
    cin>>r>>c;
    if (x[r][c] == 1 || x[r][c] == 2)
    cout<<" Wrong cell to put your sign please enter in another cell"<<endl;
    else
    {
        x[r][c]=1;
     if (x[0][0] ==1 && x[0][1] ==1 && x[0][2] == 1 && x[0][3]== 1 && x[4][4]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[1][0] ==1 && x[1][1] ==1 && x[1][2] == 1 && x[1][3]==1 && x[4][4]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[2][0] ==1 && x[2][1] ==1 && x[2][2] == 1 && x[2][3]==1 && x[4][4]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
      else if (x[3][0] ==1 && x[3][1] ==1 && x[3][2] == 1 && x[3][3]==1 && x[4][4]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[4][0] ==1 && x[4][1] ==1 && x[4][2] == 1 && x[4][3]==1 && x[4][4]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][0] ==1 && x[1][1] ==1 && x[2][2] == 1 && x[3][3]==1 && x[4][4]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][4] ==1 && x[1][3] ==1 && x[2][2] == 1 && x[3][1]==1 && x[4][0]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][0] ==1 && x[1][0] ==1 && x[2][0] == 1 && x[3][0]==1 && x[4][0]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][1] ==1 && x[1][1] ==1 && x[2][1] == 1 && x[3][1]==1 && x[4][1]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][2] ==1 && x[1][2] ==1 && x[2][2] == 1 && x[3][2]==1 && x[4][2]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
      else if (x[0][3] ==1 && x[1][3] ==1 && x[2][3] == 1 && x[3][3]==1 && x[4][3]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][4] ==1 && x[1][4] ==1 && x[2][4] == 1 && x[3][4]==1 && x[4][4]==1)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     }
    
    
    cout<< " Now player 2 enter the number of row then coloumb"<<endl;
    cin>>r>>c;
    if (x[r][c] == 1 || x[r][c] == 2)
    cout<<" Wrong cell to put your sign please enter in another cell"<<endl;
    else
    {
        x[r][c]=2;
     if (x[0][0] ==2 && x[0][1] ==2 && x[0][2] == 2 && x[0][3]== 2 && x[4][4]==2)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[1][0] ==2 && x[1][1] ==2 && x[1][2] == 2 && x[1][3]==2 && x[4][4]==2)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[2][0] ==2 && x[2][1] ==2 && x[2][2] ==2 && x[2][3]==2 && x[4][4]==2)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
      else if (x[3][0] ==2 && x[3][1] ==2 && x[3][2] == 2 && x[3][3]==2 && x[4][4]==2)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[4][0] ==2 && x[4][1] ==2 && x[4][2] ==2 && x[4][3]==2 && x[4][4]==2)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][0] ==2 && x[1][1] ==2 && x[2][2] ==2 && x[3][3]==2 && x[4][4]==2)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][4] ==2 && x[1][3] ==2 && x[2][2] ==2 && x[3][1]==2 && x[4][0]==2)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][0] ==2 && x[1][0] ==2 && x[2][0] ==2 && x[3][0]==2 && x[4][0]==2)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][1] ==2 && x[1][1] ==2 && x[2][1] ==2 && x[3][1]==2 && x[4][1]==2)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][2] ==2 && x[1][2] ==2 && x[2][2] ==2 && x[3][2]==2 && x[4][2]==2)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
      else if (x[0][3] ==2 && x[1][3] ==2 && x[2][3] ==2 && x[3][3]==2 && x[4][3]==2)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     else if (x[0][4] ==2 && x[1][4] ==2 && x[2][4] ==2 && x[3][4]==2 && x[4][4]==2)
    {
                 cout<<"player 1 wins"<<endl;
                 score1+=1;
                 check = 1;
                 break;
     }
     }
}
   if (check == 0)
   {
             cout<<" drow !!!"<<endl;
             cout<<" if you want to play again press 1"<<endl;
             cout<<" if you want to display high score press 2"<<endl;
             cout<<" if you want to exit press 3"<<endl;
             cin>> check2;  
   }
    else if (check ==1)
   {
        cout<<" Player 1 your score increased"<<endl;
        cout<<" Please enter your name"<<endl;
        cin>> name1;
        check_player_name(high_scores_level_3 ,name1 ,score1);
        cout<<" if you want to play again press 1"<<endl;
        cout<<" if you want to display high score press 2"<<endl;
        cout<<" if you want to exit press 3"<<endl;
        cin>> check2;
   }
   else if (check ==2)
   {
        cout<<" Player 2 your score increased"<<endl;
        cout<<" Please enter your name"<<endl;
        cin>> name2;
        check_player_name(high_scores_level_3 , name2  , score2);
        cout<<" if you want to play again press 1"<<endl;
        cout<<" if you want to display high score press 2

This post has been edited by quaresma: 18 May, 2008 - 08:40 AM
User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Error In Showing
18 May, 2008 - 08:44 AM
Post #2

Donkey DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 5,514



Thanked: 96 times
Dream Kudos: 2650
Expert In: ruling the world.

My Contributions
There's a lot there, do you have any start on your display?
Basically, you need something like the following, right?
CODE
X | X | X
-----------
O | O | X
-----------
O | O | X


OK, I wrote a tutorial on tic-tac-toe a while ago, here's the DisplayBoard function, maybe you can make use of it:
cpp
void printBoard ()
{
system ("cls"); // clear the screen

for (int i = 0; i < 3; i++) // printing the rows
{
for (int j = 0; j < 3; j++) // printing the cols
{
if (j != 2) // if j isn't 2 (if it isn't the final loop), we don't want | at the end
cout << board[i][j] << " | "; // | is the seperator for the board

else // print it without the | at the end (keep output pretty!)
cout << board[i][j];
}
cout << endl; // next line
if (i != 2) // if it's not the last row
cout << "---------"; // print the border

cout << endl; // move on to print the next line
}
}

Hope this helps smile.gif

This post has been edited by gabehabe: 18 May, 2008 - 08:50 AM
User is offlineProfile CardPM
+Quote Post

quaresma
RE: Error In Showing
18 May, 2008 - 12:32 PM
Post #3

New D.I.C Head
*

Joined: 5 May, 2008
Posts: 19

thnxxx
but i wanna know 2 things no 1 the defenition of "board"
2- how can i link this funtion with my code

another thing i want to make this design yes but when the player enters the number of row and coloumn the sign whether "X or O" to be drawn in the board

User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Error In Showing
18 May, 2008 - 12:59 PM
Post #4

Donkey DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 5,514



Thanked: 96 times
Dream Kudos: 2650
Expert In: ruling the world.

My Contributions
You might find it useful to look at the actual tutorial I wrote on tic-tac-toe.

It's not the most functional way of doing it, but it just puts all the tutorials before it to use. Here's the link:
http://noidea.2ksite.com/viewtopic.php?f=23&t=70

There's stuff you'll need to change, but I'm writing it as a sort of case study, so you know... smile.gif

Hopefully you can make use of it.

NOTE it fills the board with numbers 1-9 and uses those instead of getting row/col.

I hope you find it useful smile.gif
User is offlineProfile CardPM
+Quote Post

quaresma
RE: Error In Showing
18 May, 2008 - 01:22 PM
Post #5

New D.I.C Head
*

Joined: 5 May, 2008
Posts: 19

ok thnxxx
i'll check it
User is offlineProfile CardPM
+Quote Post

quaresma
RE: Error In Showing
18 May, 2008 - 01:48 PM
Post #6

New D.I.C Head
*

Joined: 5 May, 2008
Posts: 19

its amazing but there is rele somethin i need it
in my prev code i made a function called "check player name"
its to check wether the name of the player exist in a file that stores the highscores or not
if he exist it should update his score while if it doesnt exist i shoud create a new line with his name and his score
could u help me in it plz?

User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 08:40AM

Live C++ Help!