C语言大作业(全).doc
21页1、#include stdafx.h#include stdio.h#include stdlib.h#include string.h#include malloc.h#define LEN sizeof(struct student)#define NULL 0int n,m;int k=1;struct studentchar num20;char name20;int age;char profession50;int maths;int english;int C_program;float ave;struct student * next;float ave(struct student * p1)float ave;ave=(float)(p1-maths+p1-english+p1-C_program)/3;return ave;void save(struct student *head)struct student *p1 = head;FILE *outFile;outFile = fopen(stu.bin, wb);if (outFile = NULL) pr
2、intf(nFile error.); else while(p1 != NULL)fwrite(p1, sizeof(struct student), 1, outFile);p1 = p1-next;fclose(outFile);/将数据存入文档中void check(struct student * head,struct student * p1)struct student *h=head;for(m=0;mnext )if(strcmp( h-num,p1-num)=0)printf(输入号码重复n);printf(请重新输入学号:);scanf(%s,p1-num);getchar();check(head,p1);/检验学号是否重复struct student * creat()struct student * head;struct student *p1,*p2;n=0;p1=p2=(struct student *)malloc(LEN); printf(学号:n); scanf(%s,p1-num); getchar(); printf(姓名:n); gets
3、(p1-name); printf(年龄:n); scanf(%d,&p1-age);getchar(); printf(专业:n); gets(p1-profession); printf(数学成绩:n); scanf(%d,&p1-maths); printf(英语成绩:n); scanf(%d,&p1-english); printf(C语言成绩:n); scanf(%d,&p1-C_program); head=NULL;while(strcmp(p1-num,0)!=0)n=n+1;if(n=1)head=p1; else p2-next=p1;p2=p1;p1=(struct student *)malloc(LEN); printf(学号:n); scanf(%s,p1-num); getchar();check(head,p1);/检查输入的学号是不是重复且是不是重复输错 printf(姓名:n); gets(p1-name); printf(年龄:n); scanf(%d,&p1-age);getchar(); printf(专业:n); gets(p1-profes
《C语言大作业(全).doc》由会员小**分享,可在线阅读,更多相关《C语言大作业(全).doc》请在金锄头文库上搜索。
2020年高考真题——理科综合(全国卷Ⅲ)+Word版含答案
2021年绝味鸭脖策划书
2021年熟食店创业方案
2021年熟食店开店策划
2021年卤菜店创业计划书
2021年周黑鸭网络营销策划方案
东大21年1月考试《现代设计方法》考核作业
谈我国行政管理效率的现状及其改观对策(论文)
单证员考试-备考辅导-复习资料:无贸易背景信用证案分析.docx
土木工程毕业生答辩自述.docx
建筑学毕业后工作状态真实写照.doc
C#代码规范(湖南大学).doc
xx区食药监局2019年工作总结及2020年工作计划
2019年中医院药物维持治疗门诊工人先锋号先进事迹
2019年度xx乡镇林长制工作总结
2019年性艾科工作计划书
2019年人才服务局全国扶贫日活动开展情况总结
关于组工信息选题的几点思考
摘了穷帽子 有了新模样
2019年某集团公司基层党支部书记培训班心得体会
2024-04-08 33页
2024-04-08 10页
2024-04-08 25页
2024-04-08 12页
2024-04-08 10页
2024-04-08 21页
2024-04-08 40页
2024-04-08 34页
2024-04-08 28页
2024-04-08 28页