gpt4 book ai didi

c - 预期错误)

转载 作者:行者123 更新时间:2023-11-30 21:26:30 26 4
gpt4 key购买 nike

您好,您可以帮我解决我的代码吗:

    typedef struct term{
char var[10];
int val[8];
}TERM;

TERM termx[50];
int initialize();
int a[15],b[15],c[15];

int check(TERM termx[].var[],int i){
int j;
const char* const StringArray[NrOfStrings] =
{
"ABC","ABC'","AB'C'","A'B'C'","A'B'C","A'BC'","AB'C",
"AB+C","A'B'+C'","A'B'+C","A'B+C'","AB'+C'","AB'+C","
"A+BC","A'+B'C'","A'+B'C","A'+BC'","A+B'C'","A+B'C",
};
for(j=0;j<NrOfStrings;j++){
if(stcmp(term[i].var,StringArray[j])==0){
return(j);
break;
}
}

}
void main(){
int x,i,j,key;
char y[10];
initialize();
clrscr();
printf("Enter the number of terms: ");
scanf("%d",&x);
for(i=0;i<x;i++){
printf("Enter the %d term: ",i+1);
scanf("%s",termx[i].var);
for(j=0;j<strlen(termx[i].var);j++)
termx[i].var[j]=changeToupper(termx[i].var[j],i,j);
key=check(termx[i].var,i);
}
printf("\nA\tB\tC\n\n");
for(i=0;i<8;i++)
printf("%d\t%d\t%d\n",a[i],b[i],c[i]);
getch();

}

它给了我预期的“)”错误及其指向函数 check() 的参数。我知道这是一个常见错误,但我尝试搜索谷歌但找不到解决方案。我希望你能帮助我。谢谢

最佳答案

线路

int check(TERM termx[].var[],int i){

应该是这样的

int check(TERM *term,int i){

然后

key=check(termx[i].var,i);

应该阅读

key=check(termx[i],i);

关于c - 预期错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15311012/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com