2013-03-09 174 views
-4

嗨u能幫助我與我的代碼:錯誤預期)

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(); 

} 

它給了我的預期「)」錯誤和指向功能檢查的參數()。我知道這是一個常見的錯誤,但我試圖搜索谷歌,但無法找到解決方案。我希望u能幫助我it.thanks

+0

s/stcmp/strcmp/??順便說一句:main()應該返回int。 – wildplasser 2013-03-09 13:07:58

+0

請做出更好的縮進。 – Rob 2013-03-09 13:08:58

回答

1

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

應該像

int check(TERM *term,int i){ 

然後

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

應該讀

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

但它是無效的?即時通訊試圖通過termx []。var []的具體價值? – 2013-03-09 13:11:29