c语言成绩查询C语言,按学号查询学生成绩

c语言成绩查询  时间:2021-07-11  阅读:()

c语言 学生成绩管理系统

#include #include #include #define MENU_NUM 7 #define N 3 typedef struct s1 { char no[11]; /*学号由10个字符组成*/ char name[15]; /*学生姓名*/ float score[N]; /*各门课成绩*/ float sum; /*总分*/ float average; /*平均分*/ int order; /*名次*/ struct s1 *next; /*指向后继结点的指针*/ }STUDENT; /*定义结构体类型*/ STUDENT * head=NULL; void InputData( STUDENT * ptr ); void PrintMenu( ); int Menu_Select( ); void Init( ); void create( ); void print( ) ; void Delete( ); void append(); puter(); main() { int key; while(1) { key=Menu_Select(); switch(key) { case 0: Init(); //初试化链表。

也就是若链表不为空则释放链表中所有数据,将head置为空(NULL) break; case 1: create(); //创建链表,输入数据 break; case 2: Delete(); //删除一个指定学号的记录数据 break; case 3: print(); //打印链表中所有数据 break; case 4:puter(); //计算链表中所有人的总分和平均分 break; case 5: append(); //追加一个数据到链表的尾部 break; case 6: Init(); //释放链表 exit(0); } }; } void PrintMenu( ) { int i; char * menu[]={ "0. Init list", "1. Enter list", "2. Delete a record from list", "3. Print list", "4. Compute the score", "5. Insert record to list", "6. Quit" }; printf(" "); for (i=0;i
也就是释放链表中的所有数据 { STUDENT *p,*ptr;//定义两个临时指针变量p,ptr p=head;ptr=head;//将两个临时变量指向头指针head ; while(ptr!=NULL) { ptr=ptr->next;//ptr指向下一个结构数据 free(p);//释放p所指向的结构数据的内存 p=ptr;//将p指向ptr所指向的数据 } head=NULL;//将head指向NULL } void create( ) //创建单链表 { STUDENT *pt, *pth=NULL; //定义两个指针变量:pt指向即将申请新的数据内存,pth指向当前数据 while(1) { pt=(STUDENT *)malloc(sizeof(STUDENT));//让pt指向新申请的内存空间 InputData(pt);//输入数据,存放到pt所指向的结构数据。

注意让pt的next指向NULL if (strcmp(pt->no,"@")==0) { free(pt);//释放pt所指向的内存空间 break;//退出循环 } else if (head==NULL) { pth=pt; head=pt;//将头指针head和pth指向pt } else { pth->next=pt; //将pth的next指向pt; pth=pt; //将pth指向pt; } }; } void print( ) //打印单链表中所有数据 { int i=0; STUDENT *p;//第一个指针p p=head;//将p指向head printf(" "); printf("******************************STUDENT****************************** "); printf("|rec|no | name | sc1| sc2| sc3| sum | ave |order| "); printf("|---|----------|----------------|----|----|----|------|-----|-----| "); //打印表头 while (p!=NULL) { printf("|%3d|%10s|%-16s|%4.1f|%4.1f|%4.1f|%6.2f|%5.1f|%5d| ", ++i,p->no,p->name,p->score[0],p->score[1],p->score[2], p->sum,p->average,p->order); //打印p所指向的结构中的所有数据。

注意打印数据间的分隔线 p=p->next;//将p指向p的下一个结构数据 } printf("********************************END******************************** ");//打印表尾 } void Delete( ) //删除一个记录 { STUDENT *p,*pth;//定义两个指针p,pth char no[11];//定义一个整数no(用来存储输入的学号) printf("intput delete no "); scanf("%s",no);//用输入语句输入一个学号存储到no中 p=head;pth=head;//将p和pth都指向头指针 if (strcmp(p->no,no)==0) //也就是若头指针指向的数据需要删除 { head=head->next;//将head指针指向head的下一个数据; free(p);//释放p所指向的数据 } else { p=p->next;//将p指向p的下一个数据 while ( p!=NULL) { if (strcmp(p->no,no)==0) //找到了要删除的数据 { pth->next=p->next;//将pth的next指向p的next free(p);//释放p break;//退出循环 } else { pth=pth->next;//将pth指向pth的next 或 将pth指向p p=p->next;//将p指向p的next } } } } void append() { STUDENT *p,*pth;//定义两个指针变量p,pth pth=head;//将pth指向head while ( pth->next!=NULL) { pth=pth->next;//ptr指向ptr的next } p=(STUDENT *)malloc(sizeof(STUDENT));//将p指向新申请的内存空间 InputData(p);p->next=NULL;//数据数据存储到p所指向的内存空间,注意将p的next置为NULL pth->next=p;//将ptr的next指向p } void InputData( STUDENT *ptr ) { int i; printf("enter no:"); scanf("%s",ptr->no); if (strcmp(ptr->no,"@")==0 ) return; printf("enter name:"); scanf("%s",ptr->name); for(i=0;i<3;i++) { printf("shuru chengji "); scanf("%f",&ptr->score[i]); } ptr->sum=0; ptr->average=0; ptr->order=0; ptr->next=NULL; } puter() { STUDENT *p; p=head; for(;p;p=p->next) { p->sum=p->score[0]+p->score[1]+p->score[2]; p->average=(p->score[0]+p->score[1]+p->score[2])/3; } }

学生成绩管理系统 c语言

int main (void) //定义了 student 函数,用来管理学生信息 { int a,t1,t2,t3,t4 struct student * st=(struct student *)malloc(sizeof(struct student)*200); //最难的语句 定义了动态的结构体数组 struct student t5; //定义了结构体类型的临时变量t5 printf("欢迎来到学生信息管理系统! "); printf("请输入你想处理几个学生的信息?:"); scanf("%d",&t1); //t1表示学生的个数 for (t2=0;t2score) > ((st+t4)->score) ) //t3,t4用来结束循环 { t5=*(st+t3); *(st+t3)=*(st+t4); *(st+t4)=t5; } } else { if( (((st+t3))->score) < ((st+t4)->score) ) { t5=*(st+t3); *(st+t3)=*(st+t4); *(st+t4)=t5; } } } } for (t2=0;t2name,(st+t2)->score); return 0; } 打字好累,希望帮你,谢谢

用c语言设计 按课程查询成绩

先定义n个实参对应n门课程,写输入语句用switch语句写,用输出语句输出所有人的成绩单,成绩单用子程序编写,与witch语句对应。

多实践一下就行了。

C语言学生成绩管理系统

#include <stdio.h> #include <stdlib.h> #include <string.h>

struct STU { long Num; int mathScore; int englishScore; puterScore; int allScore; int averageScore; };

void sort(); void cal(); void stuPrint(); void stuInput();

#define STUNUM 60/*定义学生数*/

STU stu[STUNUM];

int main(int argc, char* argv[]) { stuInput(); cal(); sort(); stuPrint();

return 0; }

void stuInput() { int i = 0; for (;i<STUNUM;i++) { system("cls"); printf("请一个学生输入学号 "); scanf("%d",&(stu[i].Num)); printf("请输入该学生数学成绩 "); scanf("%d",&(stu[i].mathScore)); printf("请输入该学生英语成绩 "); scanf("%d",&(stu[i].englishScore)); printf("请输入该学生计算机成绩 "); scanf("%d",&(stu[i]puterScore)); } }

void cal() { int i = 0; for (;i<STUNUM;i++) { stu[i].allScore = stu[i].mathScore + stu[i]puterScore + stu[i].englishScore; stu[i].averageScore = stu[i].allScore / 3; } }

void sort() { STU temp; int i = 0 , j =0; for (;i<STUNUM-1;i++) { for ( j = i+1;j< STUNUM ;j++) { if (stu[i].allScore<stu[j].allScore) {

memcpy(&temp,&stu[i],sizeof(STU)); memcpy(&stu[i],&stu[j],sizeof(STU)); memcpy(&stu[j],&temp,sizeof(STU)); } } }

}

void stuPrint() { int i = 0; printf("名次 学号 数学成绩 英语成绩 计算机成绩 总成绩 平均成绩 "); for (;i<STUNUM;i++) { printf(" --------------------------------------------------------- "); printf("%d %d %d %d %d %d %d ",i+1,stu[i].Num,stu[i].mathScore, stu[i].englishScore,stu[i]puterScore, stu[i].allScore,stu[i].averageScore);

}

}

C语言,按学号查询学生成绩

#include #include typedef struct node //定义结点// { long num; char Name[10]; char sex; int age; struct node *next; }NODE; NODE *create(int n) //创建链表// { NODE *s,*head=NULL,*r=NULL; int i; for(i=0;i { s=(NODE *)malloc(sizeof(NODE)); printf(" 输入学号:"); scanf("%ld",&s->num); getchar(); printf(" 输入姓名:"); scanf("%s",s->Name); getchar(); printf(" 输入性别(M/W):"); scanf("%c",&s->sex); getchar(); printf(" 输入年龄:"); scanf("%d",&s->age); getchar(); s->next=NULL; if(head==NULL) { head=s; r=s; } else { r->next=s; r=s; } } return head; } void sch(N...next;; int i;%s" sch(head; scanf(" ext=s,*head=NULL; printf(" NODE *head=NULL:%s 性别,&s->num;; scanf("/:"),*r=NULL; s->%d" struct node *next;age);): %c 年龄;/:%ld 姓名; getchar(), p-> while(1) { if(p->num==num) { printf("age).h>not find;);num),&s->/ getchar():%d"输入要查找的学号, p->/ scanf("stdio; getchar();定义结点/ } else p=p->n;); for(i=0; scanf(",&n); }NODE; scanf(";Name);; typedef struct node /); } else { r-&gt,&num);i if(head==NULL) { head=s;n输入性别(M/%d&quot!" getchar();学号;; printf("创建链表/ printf(" char Name[10]:"); NODE *create(int n) / scanf(" printf("n输入年龄;next=NULL; } void sch(NODE *head,s-> printf("n请输入学生数; getchar(); #include int age;sex):";n输入学号; r=s,n,num); head=create(n).h>%d"Name; break;n输入姓名;i++) { s=(NODE *)malloc(sizeof(NODE)), p-&gt:&quot:" printf(" } } return head,&s->,int num) { NODE *p=head; r=s;); } if(p==0) printf(" getchar();%ld"sex;W); { long num; { NODE *s; char sex, p-> } main() { int num; return 0:"stdlib;;%c&quot#include &lt

  • c语言成绩查询C语言,按学号查询学生成绩相关文档

MineServer:洛杉矶CN2 GIA VPS/512MB内存/20GB NVME/800GB流量/200Mbps/KVM,58元/季

mineserver怎么样?mineserver是一家国人商家,主要提供香港CN2 KVM VPS、香港CMI KVM VPS、日本CN2 KVM VPS、洛杉矶cn2 gia端口转发等服务,之前介绍过几次,最近比较活跃。这家新推出了洛杉矶CN2 GIA VPS,512MB内存/20GB NVME/800GB流量/200Mbps/KVM,58元/季,并且进行了带宽升级,同时IP更改为美国IP。点击...

快云科技:香港沙田CN2云服务器低至29元/月起;美国高防弹性云/洛杉矶CUVIP低至33.6元/月起

快云科技怎么样?快云科技是一家成立于2020年的新起国内主机商,资质齐全 持有IDC ICP ISP等正规商家。云服务器网(yuntue.com)小编之前已经介绍过很多快云科技的香港及美国云服务器了,这次再介绍一下新的优惠方案。目前,香港云沙田CN2云服务器低至29元/月起;美国超防弹性云/洛杉矶CUVIP低至33.6元/月起。快云科技的云主机架构采用KVM虚拟化技术,全盘SSD硬盘,RAID10...

Digital-VM暑期全场六折优惠,8个机房

Digital-VM商家目前也在凑热闹的发布六月份的活动,他们家的机房蛮多的有提供8个数据中心,包括日本、洛杉矶、新加坡等。这次六月份的促销活动全场VPS主机六折优惠。Digital-VM商家还是有一点点特点的,有提供1Gbps和10Gbps带宽的VPS主机,如果有需要大带宽的VPS主机可以看看。第一、商家优惠码优惠码:June40全场主机六折优惠,不过仅可以月付、季付。第二、商家VPS主机套餐1...

c语言成绩查询为你推荐
mdmMDM程序有什么用途?删除它对系统有没有威胁?应该怎样删除?appcan怎样做手机软件akfWOW的意思是什么?AKF呢?weakhashmapJava中isEmpty方法如何使用?知识库管理系统什么是知识管理slideshare佳能复印MG3620怎么使用?inode智能客户端inode智能客户端怎么使用wifi?inode智能客户端win7如何使用校园网iNode智能客户端vipjrvipjr跟哒哒英语比,两家公司的区别在哪里?各自的特点有哪些?数秦科技奇秦科技是做什么的,大家了解过吗?
如何申请域名 缓存服务器 外国空间 最好看的qq空间 免费个人网站申请 上海域名 微信收钱 河南m值兑换 如何用qq邮箱发邮件 免费私人服务器 新睿云 闪讯官网 路由跟踪 中国电信测速网站 阿里云邮箱登陆地址 工信部icp备案查询 免费php空间 1美元 双11促销 google搜索打不开 更多