我这个有20多处错误,请大佬看看
#include
typedef enum {SOLDIER,HORSE,X,CAR,QUEEN,KING,EMPTY}Piece;
typedef enum {BLACK,WHITH}Color;
struct square{Piece a;Color b;};
int main(void)
{
int i,j;
struct square board[8][8];
(board[0][0].square.a)=(board[0][7].square.a)=(board[7][0].square.a)=(board[7][7].square.a)=CAR;
(board[0][1].square.a)=(board[0][6].square.a)=(board[7][1].square.a)=(board[7][6].square.a)=HORSE;
(board[0][2].square.a)=(board[0][5].square.a)=(board[7][2].square.a)=(board[7][5].square.a)=X;
(board[0][3].square.a)=(board[7][4].square.a)=QUEEN;
(board[0][4].square.a)=(board[7][3].square.a)=KING;
for(i=0;i<8;i++)
board[1][i].square.a=board[7][i].square.a=SOLDIER;
for(i=0;i<8;i++){
for(j=0;j<8;j++){
if(j%2=0)
baord[i][j].square.b=WHITH;
else
board[i][j].square.b=BLACK;
}
}
for(i=2;i<6;i++){
for(j=0;j<8;j++)
board[i][j].square.a=EMPTY;
}
printf("输入方格坐标:");
scanf("%d %d",&i,&j);
printf("棋子:%d颜色:%d",board[i][j].square.a,board[i][j].square.b);
return 0;
}
以下是错误信息:
ompiling...
chapter16exercise18.c
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(11) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(11) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(11) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(11) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(12) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(12) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(12) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(12) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(13) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(13) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(13) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(13) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(14) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(14) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(15) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(15) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(17) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(17) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(20) : error C2106: '=' : left operand must be l-value
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(21) : error C2065: 'baord' : undeclared identifier
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(21) : error C2109: subscript requires array or pointer type
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(21) : error C2109: subscript requires array or pointer type
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(21) : error C2224: left of '.square' must have struct/union type
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(23) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(28) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(33) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(33) : error C2039: 'square' : is not a member of 'square'
D:\c\c\第十六章结构联合枚举\chapter16exercise18.c(4) : see declaration of 'square'
Error executing cl.exe.
chapter16exercise18.obj - 27 error(s), 0 warning(s)