I was trying to draw a scrabble game. You can refer to the attach image, it was my board design. My program will ask user to put the row and column and insert the words. Example : ROW =A Column =5. But i don know how to declare the variable for each. Kindly assist. Thanks.
http://img824.imageshack.us/img824/516/capturecba.jpg
Below is my code:
void displayBoard()
{ int a = 0; static string alpha[] = {"1 ","2 ","3 ","4 ","5 ","6 ","7 ","8 ","9 ","10","11","12","13","14","15"," "};
cout <<" A B C D E F G H I J K L M N O P"<<endl;
for (int j=0; j<=14; j++)
{
cout << alpha[a];
for ( int i = 0; i <= 15; i++)
{
cout << "|_";
}
cout <<"|";
cout <<endl;
a++;
}
}
Thanks for help. I not so understand this.
for(i=0;i<word_length;i++)
{
board[word_i_offset][word_j_offset+i]=temporary_word_input[i];
}
Btw, i try re-do whole and halt on the insert.
void displayBoard()
{
int i=15;
int j=15;
int a=0;
static string alpha[] = {"1 ","2 ","3 ","4 ","5 ","6 ","7 ","8 ","9 ","10","11","12","13","14","15"," "};
cout <<" A B C D E F G H I J K L M N O"<<endl;
char board[i][j];
for(int k=0; k<j; k++)
{
cout<<alpha[a];
for(int k=0; k<j; k++)
{
board[i][j]=' ';
cout<<"|_";
}
cout<<"|";
cout<<endl;
a++;
}
cout<<endl;
}
int main()
{
int i=15;
int j=15;
int l=0;
char board[i][j];
int words,column;
char answer,rows;
displayBoard();
cout<<endl;
cout<<"Enter how many words : ";
cin>>words;
cout<<endl;
cout<<"Insert on which rows : ";
cin>>i;
cout<<endl;
cout<<"Insert on which column : ";
cin>>j;
cout<<endl;
cout<<"Insert what words : ";
cin>>answer;
cout<<endl;
for(l=0;l<words;l++)
{
board[i][j]=answer[];
}
return 0;
}