我目前正在研究一个大学项目的简单拼字游戏实现。C++初学者 - 使用结构和常量时遇到问题!
虽然我无法得到它的一部分工作!
检查了这一点:
我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;
}
}
的错误
当我比较char
s和int
s时,错误如何表明我试图比较两个Pos?
我也实在无法把这些其他错误...
感谢您的时间!
编辑:
因为我的整个项目依赖于POS,我要尝试超载<运营商它...谁能给我上的一些技巧?请记住,我是初学者!
的代码在这些错误不匹配,你在这里贴的东西。 – Thomas 2010-05-11 16:38:01
我非常抱歉:(1秒 – 2010-05-11 16:39:00
'temp'是一个结构体,但是你试图把它作为一个数组索引来传递? – 2010-05-11 16:40:18