typedef struct tsk{
int x;
int n;
}TSK;
TSK trd[MAX];
main(){
while(life!=0){
randomize();
for(i=0;i<MAX;i++){
trd[i].n=rand()%40+10;
if(trd[i].n<10||trd[i].n>45)
trd[i].n=rand()%40+10;
trd[i].x=25;
}
for(m=0;m<MAX;m++){
gotoxy(8,m);printf("%c%c",23,23);
gotoxy(7,m);printf("%c",17);
gotoxy(46,m);printf("%c%c",23,23);
gotoxy(48,m);printf("%c",16);
}
for(j=0;j<MAX;j++){
if(life==0)
break;
gotoxy(1,1);
insline();
gotoxy(trd[j].n,1);
printf("%c",3);
trd[j].x--;
gotoxy(ply,25);
printf("%c",1);
gotoxy(1,26);
delline();
score++;
life=hit(trd,life,ply);
gotoxy(57,25);
printf("SCORE: %0.0f LIFE: %d",score,life);
gotoxy(8,1);printf("%c%c",23,23);
gotoxy(46,1);printf("%c%c",23,23);
gotoxy(7,1);printf("%c",17);
gotoxy(48,1);printf("%c",16);
gotoxy(4,1);printf("%c",label[j]);
delay(200);
if(kbhit()){
key=getch();
key=toupper(key);
if(key==27)
life=0;
if(key=='L')
ply++;
if(ply==46)
ply--;
else if(key=='K')
ply--;
if(ply==9)
ply++;
}
}
}
}
int hit(int trd[],int life, int ply){
int i;
for(i=0;i<MAX;i++){
if((trd[i].n==ply)&&(trd[i].x==0))
life-=1;
}
return life;
}
任何人都可以帮助我如何纠正这个错误: . 左侧需要结构 或者 。*?当我运行程序时,它给了我这个错误,它指向 hit() 函数。我找不到导致此错误的原因。请帮助。谢谢。