Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 759555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:36:39+00:00 2026-05-14T15:36:39+00:00

I hope this question takes a simple fix, and I am just missing something

  • 0

I hope this question takes a simple fix, and I am just missing something very small.

I am in my second semester of C++ in college, and we are just getting into OOP. This is my first OOP program, and it is causing me a little problem. Here are the errors I am getting:

Member function must be called or its address taken in function displayGrid(int,Cell ( *)[20])
Member function must be called or its address taken in function Turn(int,int,Cell ( *)[20])
Member function must be called or its address taken in function Turn(int,int,Cell ( *)[20])
Warning: Parameter 'grid' is never used in function displayGrid(int,Cell ( *)[20])

Here is all of my code. I am aware It is much more code than necessary, sorry if it makes it more difficult. I was worried that I might accidentally delete something.

const int MAX=20;

//Struct Cell holds player and their symbol.
class Cell
{
 private:
  int Player;
  char Symbol;

 public:
  Cell(void);
  void setPlayer(int);
  void setSymbol(char);
  int getPlayer(void);
  char getSymbol(void);

};
 Cell::Cell(void)
 {
  Symbol ='-';
 }

 void Cell::setPlayer(int player_num)
 {
  Player = player_num;
 }

 void Cell::setSymbol(char rps)
 {
  Symbol = rps;
 }

 int Cell::getPlayer(void)
 {
  return Player;
 }

 char Cell::getSymbol(void)
 {
  return Symbol;
 }

  void Turn(int, int, Cell[MAX][MAX]);
  void displayGrid(int, Cell[MAX][MAX]);

void main(void)
{
 int size;

 cout << "How big would you like the grid to be: ";
 cin >> size;

    //Checks to see valid grid size
 while(size>MAX || size<3)
 {
  cout << "Grid size must between 20 and 3." << endl;
  cout << "Please re-enter the grid size: ";
  cin >> size;
 }

 int cnt=1;
 int full;
 Cell grid[MAX][MAX];

 //I use full to detect when the game is over by squaring size.
 full = size*size;
 cout << "Starting a new game." << endl;

 //Exits loop when cnt reaches full.
 while(cnt<full+1)
 {
  displayGrid(size, grid); //calls function to display grid

  if(cnt%2==0)  //if cnt is even then it's 2nd players turn
   cout << "Player 2's turn." << endl;
  else
   cout << "Player 1's turn" << endl;

  Turn(size, cnt, grid); //calls Turn do each players turn

  cnt++;
 }

 cout << endl;

 cout << "Board is full... Game Over" << endl;
 }


void displayGrid(int size, Cell grid[MAX][MAX])
 {
  cout << endl;
  cout << "  ";

  for(int x=1; x<size+1; x++)     // prints first row
   cout << setw(3) << x;       // of numbers.

  cout << endl;

  //Nested-For prints the grid.
  for(int i=1; i<size+1; i++)
  {
   cout << setw(2) << i;

    for(int c=1; c<size+1; c++)
    {
     cout <<  setw(3) << grid[i][c].getSymbol;
    }
    cout << endl;
   }

   cout << endl;
  }

void Turn(int size, int cnt, Cell grid[MAX][MAX])
  {
   char temp;
   char choice;
   int row=0;
   int column=0;

   cout << "Enter the Row: ";
   cin >> row;

   cout << "Enter the Column: ";
   cin >> column;

   //puts what is in the current cell in "temp"
   temp = grid[row][column].getSymbol;

   //Checks to see if temp is occupied or not
   while(temp!='-')
   {
    cout << "Cell space is Occupied..." << endl;
    cout << "Enter the Row: ";
    cin >> row;

    cout << "Enter the Column: ";
    cin >> column;

          temp = grid[row][column].getSymbol; //exits loop when finally correct
     }

   if(cnt%2==0) //if cnt is even then its player 2's turn
   {
    cout << "Enter your Symbol R, P, or S (Capitals): ";
    cin >> choice;
    grid[row][column].setPlayer(1);

   in >> choice;
       }

    //officially sets choice to grid cell
       grid[row][column].setSymbol(choice);
   }

   else //if cnt is odd then its player 1's turn
   {
    cout << "Enter your Symbol r, p, or s (Lower-Case): ";
    cin >> choice;
    grid[row][column].setPlayer(2);

    //checks for valid input by user1
    while(choice!= 'r' && choice!='p' && choice!='s')
    {
     cout << "Invalid Symbol... Please Re-Enter: ";
     cin >> choice;
       }

    //officially sets choice to grid cell.
       grid[row][column].setSymbol(choice);
   }

   cout << endl;
  }

Thanks alot for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:36:39+00:00Added an answer on May 14, 2026 at 3:36 pm

    The following line:

     cout <<  setw(3) << grid[i][c].getSymbol;
    

    Doesn’t call the function. Write this instead:

     cout <<  setw(3) << grid[i][c].getSymbol();
    

    Likewise for the other error messages.

    The warning is generated because the erroneous line is the only time displayGrid uses the grid parameter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.