hello all;
im kinda new to this kinda stuff was just wondering if someone could please help me out with the following parts i have there
... my compiler isnt really letting me draw the board it keeps on insisiting that i have invalid types of data.. also i cant use too many advanced features it has to be really simplisitc ... no vectors or just a simple array.
below is roughly what is ment to happen ... if anybody can show me a pathway or how to accomplsh this it would be really helpfull thankyou.

1. The function void initialiseBoard(char[ROW][COL]) initialises the 2D
array, which will store the configuration of the board during the game, that is, this
array will be updated according to each player’s move.
2. The function void drawBoard(char[ROW][COL]) draws the current
configuration of the board at the beginning of the game and after each player’s move.
For example, after two moves from Player 1 and one move from Player 2 the board’s
configuration could be:
........
........
........
........
O.......
X...O...
12345678
Where 'O' is a constant char that represents the move of Player 1 and 'X' is a
constant char that represents the move of Player 2.
3. The function int playerMove(char[ROW][COL], char, int) must
check if the user’s input is valid – i.e. an integer between 0 and 8, and if there is room
in the column chosen for one more piece– update the 2D array, which stores the
game’s configuration according to the users input, and return the user’s input to the
calling function. The function’s arguments of type char and int are used to pass to
the function the character ‘O’ and the integer 1 for player’s 1 move, and ‘X’ and 2 for
player 2.

>>my compiler isnt really letting me draw the board it keeps on insisiting that i have invalid types of data

Post your code -- my eyes are not good enough to see your monitor.

> it keeps on insisiting that i have invalid types of data.
I'm guessing the problem is in the way you're trying to pass an array to a function.

A prototype of void initialiseBoard(char array[ROW][COL]); Needs char array[ROW][COL]; You can name it whatever you want, but the dimensions need to match.

And a call of initialiseBoard( array );

dont no if this is correct though any help would be greatly appreciated all the code in the board voids are like under construction still so i not sure

#include <iostream>
#include <stdlib.h>
const int COL = 8;
const int ROW = 7;
void drawHeader();
char chooseOption();
void initialiseBoard(char[ROW][COL]);
void drawBoard(char[ROW][COL]);
int playerMove(char[ROW][COL], char, int);
void drawHeader();
int main(int argc, char *argv[])
{
  drawHeader();
  chooseOption();
  
  
  
  system("PAUSE"); 
  return 0;
}
void drawHeader()
{
cout << "*********************************************************" << endl;
cout << "*                      Connect Four                     *" << endl;
cout << "*********************************************************" << endl;
cout << "Welcome to the Connect Four computer game. You can choose" << endl;
cout << "to play against another player or against the computer" << endl;
cout << "(not implemented in this version)." << endl;
cout << "In this game the first player to position four of his/her" << endl;
cout << "pieces on a line will win. The line can be horizontal," << endl;
cout << "vertical or at an angle, but the 4 pieces must be next to" << endl;
cout << "each other." << endl;
cout << "*********************************************************" << endl;
}
char chooseOption()
{
cout << "*************************************" << endl;
cout << "*          Choose an Option         *" << endl;
cout << "*************************************" << endl;
cout << "* a) Play against the computer *" << endl;
cout << "* b) Play against another player *" << endl;
cout << "* c) Quit *" << endl;
cout << "*************************************" << endl;
char option;
cin >> option;
if (option == 'a')
{
cout << "This option has not yet been implemented" << endl;
return chooseOption();
}
else if (option == 'b') 
{
cout << "you entered b" << endl;

}
else if (option == 'c') 
{
cout << "Thanks for playing Connect Four, the game of" << endl;
cout << "clever people!" << endl;
}
else 
{
cout << "your input was invalid" << endl;
return chooseOption();
}
return 0;
}

void drawBoard(char[ROW][COL])
{
    
}
  

void initialiseBoard(char array [ROW][COL])
{
int i = 0, j = 0;
int board;
for (i = 0; i < 7; ++i)
for (j = 0; j < 7; ++j)
board[ROW][COL] = '.';
//for(i = 0; i < 7; ++i)
  //for(j = 0; j < 7; ++j)
    //  board[ROW][COL] = '*';  //fill board with *s
//display board
//for(i = 0; i < 7; ++i)
//{
 // for (j = 0; j < 7; ++j)
 // {
 //    cout << board[ROW][COL];
 // }
 // cout << endl;
//}
  // for (char [ROW]  = 0; [ROW] < 7; [ROW]++);
  // {
   //   for (char [COL] = 0; [COL] < 7; [COL]++);
   //   {
   //   cout << '.';
    //  if ([COL] == 9);
   //   break;
    //  }
    //  cout << endl;
    //  }
      

}
int playerMove(char array [ROW][COL], char playerSymbol, int player)
{
int move = 0;
char select;
cout << "Player 1" << "move (1-8, 0 to quit)" << endl;
cin >> move;
if (move == (1>= move <= 8))
{
cout << "keep playing" << endl;
}
else if (move == 0)
{
cout << "Do you want to start a new game: (y/n)?:" << endl;
cin >> select;
if (select == 'y')
{
cout << "you have selected to play again" << endl;
}
else if (select == 'n')
{
cout << "you have seleceted to quit the game" << endl;
}
else 
cout << "try again" << endl;
}
}
This article has been dead for over six months. Start a new discussion instead.