Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我是新手,请大家帮忙看一下#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct Node { char TOKEN[9]; int sum; Node *next; }Node,* sqlist; void init(sqlist &L) { L=(Node *)malloc(sizeof(Node)); L->next=NULL; L->sum=0; } void insert(sqlist &L,char TOKEN1[9]) { sqlist q=NULL; sqlist p=L; while(1) { if(strcmp(p->TOKEN,TOKEN1)==0) {p->sum++;return;} else if((p->next==NULL)||(strcmp(p->next->TOKEN,TOKEN1)>0)) break; else p=p->next; } q=(Node *)malloc(sizeof(Node)); strcpy(q->TOKEN,TOKEN1); q->sum=1; q->next=p->next; p->next=q; } char cert(char a,char table[9][3]) { int x=0; int y=0; if((a>=0x30)&&(a<=0x39)) return a; else { x=(a-65)/3; y=(a-65)%3; return table[x][y]; } } void vert(char TOKEN[9],char table[9][3]) { char TOKEN2[20]; scanf(" %s",&TOKEN2); int i=0; int j=0; while(1) { if(i>=8) break; if(i==3) {TOKEN[i]='-';i++;} else if(TOKEN2[j]!='-') {TOKEN[i]=cert(TOKEN2[j],table);i++;j++;} else j++; } TOKEN[i]='\0'; } void print(sqlist L) { sqlist q=L->next; while(q!=NULL) { if(q->sum>1) {printf("%s ",q->TOKEN);printf("%d\n",q->sum);} q=q->next; } } void main() { sqlist L; init(L); int sum=0; char TOKEN[9]; scanf("%d",&sum); char table[9][3]={'2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7','0','7','7','8','8','8','9','9','9','0','0'}; for(int i=0;i<sum;i++) { vert(TOKEN,table); insert(L,TOKEN); } print(L); } 在V++6.0上没有什么问题呀,为什么编译出错了~ Compile Error Main.c Main.c(8) : error C2061: syntax error : identifier 'Node' Main.c(9) : error C2059: syntax error : '}' Main.c(11) : error C2143: syntax error : missing ')' before '&' Main.c(11) : error C2143: syntax error : missing '{' before '&' Main.c(11) : error C2059: syntax error : '&' Main.c(11) : error C2059: syntax error : ')' Main.c(18) : error C2143: syntax error : missing ')' before '&' Main.c(18) : error C2143: syntax error : missing '{' before '&' Main.c(18) : error C2059: syntax error : '&' Main.c(18) : error C2059: syntax error : ')' Main.c(60) : error C2143: syntax error : missing ';' before 'type' Main.c(61) : error C2143: syntax error : missing ';' before 'type' Main.c(64) : error C2065: 'i' : undeclared identifier Main.c(65) : error C2065: 'i' : undeclared identifier Main.c(65) : error C2065: 'i' : undeclared identifier Main.c(65) : error C2065: 'i' : undeclared identifier Main.c(66) : error C2065: 'j' : undeclared identifier Main.c(66) : error C2065: 'i' : undeclared identifier Main.c(66) : error C2065: 'j' : undeclared identifier Main.c(66) : error C2065: 'i' : undeclared identifier Main.c(66) : error C2065: 'j' : undeclared identifier Main.c(67) : error C2065: 'j' : undeclared identifier Main.c(70) : error C2065: 'i' : undeclared identifier Main.c(75) : error C2146: syntax error : missing ')' before identifier 'L' Main.c(75) : error C2061: syntax error : identifier 'L' Main.c(75) : error C2059: syntax error : ';' Main.c(75) : error C2059: syntax error : ')' Main.c(76) : error C2449: found '{' at file scope (missing function header?) Main.c(86) : error C2059: syntax error : '}' Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator