- #include<reg51.h>
- #include<stdio.h>
- #include<string.h>
- struct people
- {
- char name[8];
- int score;
- };
- struct people tmp;
- void main()
- {
- struct people xdata p[5];
- unsigned char count=0;
- for(count=0;count<=4;count++)
- {
- scanf("%s,%d",&p[count].name,&p[count].score);
- }
- unsigned char a,b;
- for(a=0;a<=4;a++)
-
- for(b=3;b>=a;b--)
- {
- if(p[b+1].score>p[b].score)
- {
- strcpy(tmp.name,p[b+1].name);
- tmp.score=p[b+1].score;
- strcpy(p[b+1].name,p[b].name);
- p[b+1].score=p[b].score;
- strcpy(p[b].name,tmp.name);
- p[b].score=tmp.score;
- }
- }
-
-
- }
复制代码一直显示
- Build target 'Target 1'
- compiling new.c...
- NEW.C(19): error C141: syntax error near 'unsigned'
- NEW.C(19): error C202: 'a': undefined identifier
- NEW.C(20): error C202: 'a': undefined identifier
- NEW.C(22): error C202: 'b': undefined identifier
- NEW.C(24): error C202: 'b': undefined identifier
- NEW.C(26): error C202: 'b': undefined identifier
- NEW.C(27): error C202: 'b': undefined identifier
- NEW.C(28): error C202: 'b': undefined identifier
- NEW.C(29): error C202: 'b': undefined identifier
- NEW.C(30): error C202: 'b': undefined identifier
- NEW.C(31): error C202: 'b': undefined identifier
- Target not created
复制代码
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>