no match for operator?

Nyap

HTML Noob
OP
Banned
Joined
Jan 13, 2016
Messages
971
Trophies
0
Age
55
Location
That Chaos Site
XP
483
Country
why doesn't this code work (not finished it yet btw, I just want to know why I'm getting compile errors)
Code:
#include <iostream>

using std::cout;
using std::cin;

struct point
{
  bool circlex; //0=O, 1=X
  bool isempty;
};

void render(point points)
{
  int line{1};
  int across{0};
  while (across<9)
  {
  if (!(line % 2))
  {
  cout << "######\n";
  ++line;
  continue;
  }

  if (points[across].isempty==1)
  {
  cout << " ";
  }
  else if (points[across].circlex==0)
  {
  cout << "O";
  }
  else if (points[across].circlex==1)
  {
  cout << "X";
  }

  if (across==1 || across==2)
  {
  cout << "#";
  }
  ++across;
  }
}

int main()
{
  point tictactoe[9];
  render(tictactoe);
}
||=== Build: Debug in TicTacToe (compiler: GNU GCC Compiler) ===|
/home/nyap/Projects/TicTacToe/main.cpp||In function ‘void render(point)’:|
/home/nyap/Projects/TicTacToe/main.cpp|25|error: no match for ‘operator[]’ (operand types are ‘point’ and ‘int’)|
/home/nyap/Projects/TicTacToe/main.cpp|29|error: no match for ‘operator[]’ (operand types are ‘point’ and ‘int’)|
/home/nyap/Projects/TicTacToe/main.cpp|33|error: no match for ‘operator[]’ (operand types are ‘point’ and ‘int’)|
/home/nyap/Projects/TicTacToe/main.cpp||In function ‘int main()’:|
/home/nyap/Projects/TicTacToe/main.cpp|49|error: could not convert ‘(point*)(& tictactoe)’ from ‘point*’ to ‘point’|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
 
Last edited by Nyap,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: https://a.co/d/8tRQnqT