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语言,按学号查询学生成绩相关文档

湖北50G防御物理服务器( 199元/月 ),国内便宜的高防服务器

4324云是成立于2012年的老牌商家,主要经营国内服务器资源,是目前国内实力很强的商家,从价格上就可以看出来商家实力,这次商家给大家带来了全网最便宜的物理服务器。只能说用叹为观止形容。官网地址 点击进入由于是活动套餐 本款产品需要联系QQ客服 购买 QQ 800083597 QQ 2772347271CPU内存硬盘带宽IP防御价格e5 2630 12核16GBSSD 500GB​30M​1个IP...

两款半月湾 HMBcloud 春节88折日本和美国CN2 VPS主机套餐

春节期间我们很多朋友都在忙着吃好喝好,当然有时候也会偶然的上网看看。对于我们站长用户来说,基本上需要等到初八之后才会开工,现在有空就看看是否有商家的促销。这里看到来自HMBcloud半月湾服务商有提供两款春节机房方案的VPS主机88折促销活动,分别是来自洛杉矶CN2 GIA和日本CN2的方案。八八折优惠码:CNY-GIA第一、洛杉矶CN2 GIA美国原生IP地址、72小时退款保障、三网回程CN2 ...

A400互联37.8元/季,香港节点cn2,cmi线路云服务器,1核/1G/10M/300G

A400互联怎么样?A400互联是一家成立于2020年的商家,A400互联是云服务器网(yuntue.com)首次发布的云主机商家。本次A400互联给大家带来的是,全新上线的香港节点,cmi+cn2线路,全场香港产品7折优惠,优惠码0711,A400互联,只为给你提供更快,更稳,更实惠的套餐,香港节点上线cn2+cmi线路云服务器,37.8元/季/1H/1G/10M/300G,云上日子,你我共享。...

c语言成绩查询为你推荐
联想网盘联想网盘收费吗,怎么样weakhashmapJava///map的父类是?云图片华为手机的云照片怎么不见了怎么办jdk6java—JDK6,在SUN公司官网下载的链接,索引超出了数组界限索引超出了数组界限网页微信客户端什么叫微信网页版?和电脑版是一回事吗?spawning为什么编译和运行vc++ 时会出现Error spawning c1.exe 的错误radius认证电信或网通的RADIUS认证都记录些什么?谁能说说ISP的宽带帐号检查流程欢迎页面怎样在开机制造欢迎页面?faq是什么意思fans是什么意思?
成都虚拟主机 什么是二级域名 新加坡服务器 免费ftp空间 英文简历模板word 创梦 php空间推荐 亚马逊香港官网 vip域名 台湾google 视频服务器是什么 百度云加速 游戏服务器出租 免费asp空间申请 中国域名 双线空间 umax 国外免费网盘 聚惠网 沈阳idc 更多