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

pacificrack:超级秒杀,VPS低至$7.2/年,美国洛杉矶VPS,1Gbps带宽

pacificrack又追加了3款特价便宜vps搞促销,而且是直接7折优惠(一次性),低至年付7.2美元。这是本月第3波便宜vps了。熟悉pacificrack的知道机房是QN的洛杉矶,接入1Gbps带宽,KVM虚拟,纯SSD RAID10,自带一个IPv4。官方网站:https://pacificrack.com支持PayPal、支付宝等方式付款7折秒杀优惠码:R3UWUYF01T内存CPUSS...

pia云低至20/月,七折美国服务器

Pia云是一家2018的开办的国人商家,原名叫哔哔云,目前整合到了魔方云平台上,商家主要销售VPS服务,采用KVM虚拟架构 ,机房有美国洛杉矶、中国香港和深圳地区,洛杉矶为crea机房,三网回程CN2 GIA,带20G防御,常看我测评的朋友应该知道,一般带防御去程都是骨干线路,香港的线路也是CN2直连大陆,目前商家重新开业,价格非常美丽,性价比较非常高,有需要的朋友可以关注一下。活动方案...

香港 E5-2650 16G 10M 900元首月 美国 E5-2660 V2 16G 100M 688元/月 华纳云

华纳云双11钜惠出海:CN2海外物理服务器终身价688元/月,香港/美国机房,免费送20G DDos防御,50M CN2或100M国际带宽可选,(文内附带测评)华纳云作为一家专业的全球数据中心基础服务提供商,总部在香港,拥有香港政府颁发的商业登记证明,APNIC 和 ARIN 会员单位。主营香港服务器、美国服务器、香港/美国OpenStack云服务器、香港高防物理服务器、美国高防服务器、香港高防I...

c语言成绩查询为你推荐
row函数EXCEL 中的 ROW函数0x80070005计划任务时出现错误代码80070005flash控件手机怎么安装flash插件showwindowC#中showwindow控件在哪里??网页微信客户端手机微信客户端怎么打开网页flowplayerswfobject.js这能不能播放音频啊(amr)waves插件MuseScore vst插件怎么安装清除电脑垃圾怎样清除电脑里的垃圾cf加速器玩cf ping高用什么加速器比较好jsindexofjavascript 中indexof 的用法
长沙域名注册公司 免费域名空间申请 vps侦探 ftp空间 华为云服务 国内免备案主机 老鹰主机 directadmin 好玩的桌面 云主机51web 网通ip 灵动鬼影 日本bb瘦 网站cdn加速 免费吧 paypal注册教程 美国盐湖城 服务器防火墙 服务器论坛 阿里云手机官网 更多