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

justhost:“第4次VPS测评”,8.3元/月,200M带宽,不限流量,KVM虚拟,4个俄罗斯机房应有适合你的

justhost.ru官方来消息说已经对网络进行了比较全面的优化,针对中国电信、联通、移动来说,4个机房总有一个适合中国用户,让站长进行一下测试,这不就有了这篇有关justhost的VPS的第四次测评。本帖主要关注的是网络,对于其他的参数一概不管! 官方网站:https://justhost.ru 最低配VPS:8.3元/月,KVM,512M内存,5G硬盘,200M带宽,不限流量 购买链接:...

spinservers:10Gbps带宽高配服务器月付89美元起,达拉斯/圣何塞机房

spinservers是一家主营国外服务器租用和Hybrid Dedicated等产品的商家,Majestic Hosting Solutions LLC旗下站点,商家数据中心包括美国达拉斯和圣何塞机房,机器一般10Gbps端口带宽,且硬件配置较高。目前,主机商针对达拉斯机房机器提供优惠码,最低款Dual E5-2630L v2+64G+1.6TB SSD月付89美元起,支持PayPal、支付宝等...

ShockHosting日本机房VPS测试点评

这个月11号ShockHosting发了个新上日本东京机房的邮件,并且表示其他机房可以申请转移到日本,刚好赵容手里有个美国的也没数据就发工单申请新开了一个,这里做个简单的测试,方便大家参考。ShockHosting成立于2013年,目前提供的VPS主机可以选择11个数据中心,包括美国洛杉矶、芝加哥、达拉斯、杰克逊维尔、新泽西、澳大利亚、新加坡、日本、荷兰和英国等。官方网站:https://shoc...

c语言成绩查询为你推荐
gravatarWordPress头像无法显示怎么办soapui下载测试管理工具的soapUI开源测试工具g2g吉他的效果器的名称是什么意思?(G1G,G2G等等)最开放的浏览器目前最好的游览器?调度系统生产调度系统waves插件请问下waves9是什么东西,插件吗?ruby语言公司实习让我学习RUBY语言,不知道RUBY语言发展前景怎么样,值不值的去学习。cf加速器玩CF需要用加速器吗?基础设施即服务基础设施行业的定义是什么?具体包含哪些行业?watch的过去式wach的过去式
cn域名个人注册 flashfxp怎么用 大硬盘 l5520 512m内存 web服务器架设软件 panel1 php空间申请 刀片服务器是什么 南通服务器 天翼云盘 卡巴斯基免费试用版 腾讯总部在哪 四川电信商城 带宽租赁 杭州电信宽带优惠 买空间网 服务器硬件配置 域名和主机 博客域名 更多