跪求今年的省考C语言示范真题,有资源者发我必有重谢,C语言挂了n次了 真的伤不起了 !!!!必有重谢
2016-06-19
展开全部
你的题目要求是什么数据没有初始化而且没有那么多错误#include#defineNULL0#defineLENsizeof(structstudent)structstudent{charno[5];floatscore;structstudent*next;};structstudent*create();voidprint(structstudent*head);voidmain(){structstudent*list_headp;list_headp=create();//是赋值为结构体,不用加*print(list_headp);}structstudent*create(){structstudent*head=NULL,*tail,*new;intcount=0;for(;;){new=(structstudent*)malloc(LEN);//stu代表structstudentprintf("pleaseinputthenumberofstudentNo.%d:\n",count+1);scanf("%s",new->no);if(strcmp(new->no,'*')==0){free(new);break;}printf("inputthescoreofstudentNo.%d",count+1);scanf("%f",&new->score);count++;if(count==1)head=new;elsetail->next=new;tail=new;new->next=NULL;}returnhead;}voidprint(structstudent*head){structstudent*p;p=head;if(head==NULL)printf("thelinkisempty\n");elsewhile(p!=NULL)//——————判断两个数不相等的话,用一个=就行了,只有相等才需要=={printf("%5s%4.1f",p->no,p->score);p=p->next;}}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询