string array

closed account (1v5E3TCk)
i am working on a ticktacktoe game for a while. I code it with 9 string first but i decided to re code it using 2 dimensional array.But i need to use it as string. I code a little for my new game but it is not working.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <string>
using namespace std;

int tur=1;



int boardfonk(int alan){
   
    string board[ alan+1 ][ alan+1 ];
   
   if(tur==1){
   for( int i=1; i<=alan ; ++i){
            for(int j; j<alan; ++j){
                    board[ i ][ j ] ="|.'i*j'.|";}}// i want there to give number to each box which is playable.But i think there is a problem
}                    
   for(int i=1; i<=alan ; ++i){
            for(int j=1; j<alan; ++j){
                    cout<<board[ i ][ j ]<<endl;}
            
    
            
            }
   
    }


int main(){
    int alan;
    
    string oyuncu1;
    string oyuncu2;
    
    cout<<"Alan buyuklugunu seciniz:";
    cin>> alan; //the board is sizeable so it ask to use the size. alan*alan,3*3,4*4 etc..
    
    cout<<"1.oyuncunun adini girin:";
    cin>> oyuncu1;  
    cout<<"2.oyuncunun adini girin:";
    cin>> oyuncu2;
        
    
    boardfonk( alan );
    system("pause");
    
    
    }
Topic archived. No new replies allowed.