【发布时间】:2010-05-11 16:35:21
【问题描述】:
我目前正在为一个大学项目做一个简单的拼字游戏实现。
不过,我无法让它发挥作用!
看看这个:
我的board.h:
错误所在的子程序:
//Following snippet contained in board.cpp
//I believe the function is self-explanatory...
//Pos is a struct containing a char, y, a int, x and an orientation, o, which is not //used in this particular case
void Board::showBoard()
{
Pos temp;
temp.o = 0;
for (temp.y = 'A'; temp.y < (65 + TOTAL_COLUMNS); ++temp.y)
{
for (temp.x = 1; temp-x < (1 + TOTAL_ROWS); ++temp.x)
{
cout << _matrix[temp].getContents();
}
cout << endl;
}
}
编译时返回的错误:
当我比较 chars 和 ints 时,为什么会出现错误提示我正在尝试比较两个 Pos?
我也真的无法放置这些其他错误...
感谢您的宝贵时间!
编辑:
由于我的整个项目都依赖于 Pos,我将尝试为它重载
【问题讨论】:
-
这些错误中的代码与您在此处粘贴的不匹配。
-
temp是一个结构,但您试图将其作为数组索引传递?
标签: c++ class struct global-variables