问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

跪求c语言学生管理系统程序,,,有没有学霸学神,,,最后一次平时成绩就靠这个了,,,,

发布网友 发布时间:2022-05-27 09:56

我来回答

3个回答

热心网友 时间:2023-10-15 23:35

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<dos.h>
#include<string.h>
#define LEN sizeof(struct student)
#define FORMAT "%-8d%-15s%-12.1lf%-12.1lf%-12.1lf%-12.1lf\n"
#define DATA stu[i].num,stu[i].name,stu[i].elec,stu[i].expe,stu[i].requ,stu[i].sum
struct student
{ int num;
char name[15];
double elec;
double expe;
double requ;
double sum;
};
struct student stu[50];
void in();
void show();
void order();
void del();
void modify();
void menu();
void insert();
void total();
void search();
void main()
{ int n;
menu();
scanf("%d",&n);
while(n)
{ switch(n)
{ case 1: in();break;
case 2: search();break;
case 3: del();break;
case 4: modify();break;
case 5: insert();break;
case 6: order();break;
case 7: total();break;
default:break;
}
getch();
menu();
scanf("%d",&n);
}
}void in()
{ int i,m=0;
char ch[2];
FILE *fp;
if((fp=fopen("data.txt","a+"))==NULL)
{ printf("can not open\n");return;}
while(!feof(fp)) {
if(fread(&stu[m] ,LEN,1,fp)==1)
m++;
}
fclose(fp);
if(m==0)
printf("No record!\n");
else
{
system("cls");
show();
}
if((fp=fopen("data.txt","wb"))==NULL)
{ printf("can not open\n");return;}
for(i=0;i<m;i++)
{
fwrite(&stu[i] ,LEN,1,fp);
}
printf("please input(y/n):");
scanf("%s",ch);
while(strcmp(ch,"Y")==0||strcmp(ch,"y")==0)
{
printf("number:");
scanf("%d",&stu[m].num);/*输入学生学号*/
for(i=0;i<m;i++)
if(stu[i].num==stu[m].num)
{
printf("the number is existing,press any to continue!");
getch();
fclose(fp);
return;
}
printf("name:");
scanf("%s",stu[m].name);
printf("elective:");
scanf("%lf",&stu[m].elec);
printf("experiment:");
scanf("%lf",&stu[m].expe);
printf("required course:");
scanf("%lf",&stu[m].requ);
stu[m].sum=stu[m].elec+stu[m].expe+stu[m].requ;
if(fwrite(&stu[m],LEN,1,fp)!=1)/*将新录入的信息写入指定的磁盘文件*/
{ printf("can not save!"); getch(); }
else { printf("%s saved!\n",stu[m].name);m++;}
printf("continue?(y/n):");/*询问是否继续*/
scanf("%s",ch);
}
fclose(fp);
printf("OK!\n");
}void show()
{ FILE *fp;
int i,m=0;
fp=fopen("data.txt","rb");
while(!feof(fp))
{
if(fread(&stu[m] ,LEN,1,fp)==1)
m++;
}
fclose(fp);
printf("number name elective experiment required sum\t\n");
for(i=0;i<m;i++)
{
printf(FORMAT,DATA);//
}
}

void menu()
{
system("cls");
printf("\n\n\n\n\n");
printf("\t\t|---------------------STUDENT-------------------|\n");
printf("\t\t|\t 0. exit |\n");
printf("\t\t|\t 1. input record |\n");
printf("\t\t|\t 2. search record |\n");
printf("\t\t|\t 3. delete record |\n");
printf("\t\t|\t 4. modify record |\n");
printf("\t\t|\t 5. insert record |\n");
printf("\t\t|\t 6. order |\n");
printf("\t\t|\t 7. number |\n");
printf("\t\t|-----------------------------------------------|\n\n");
printf("\t\t\tchoose(0-7):");
}void order()/*自定义排序函数*/
{ FILE *fp;
struct student t;
int i=0,j=0,m=0;
if((fp=fopen("data.txt","r+"))==NULL)
{
printf("can not open!\n");
return;
}
while(!feof(fp))
if(fread(&stu[m] ,LEN,1,fp)==1)
m++;
fclose(fp);
if(m==0)
{
printf("no record!\n");
return;
}
if((fp=fopen("data.txt","wb"))==NULL)
{
printf("can not open\n");
return;}
for(i=0;i<m-1;i++)
for(j=i+1;j<m;j++)
if(stu[i].sum<stu[j].sum)
{ t=stu[i];stu[i]=stu[j];stu[j]=t;}
if((fp=fopen("data.txt","wb"))==NULL)
{ printf("can not open\n");return;}
for(i=0;i<m;i++)
if(fwrite(&stu[i] ,LEN,1,fp)!=1)
{
printf("%s can not save!\n");
getch();
}
fclose(fp);
printf("save successfully\n");
}
void del()/*自定义删除函数*/
{FILE *fp; int snum,i,j,m=0; char ch[2]; if((fp=fopen("data.txt","r+"))==NULL) { printf("can not open\n");return;}
while(!feof(fp)) if(fread(&stu[m],LEN,1,fp)==1) m++;
fclose(fp);
if(m==0)
{
printf("no record!\n");
return;
}
printf("please input the number:");
scanf("%d",&snum);
for(i=0;i<m;i++)
if(snum==stu[i].num)
break;
printf("find the student,delete?(y/n)");
scanf("%s",ch);
if(strcmp(ch,"Y")==0||strcmp(ch,"y")==0)/*判断是否要进行删除*/
for(j=i;j<m;j++)
stu[j]=stu[j+1];/*将后一个记录移到前一个记录的位置*/
m--;/*记录的总个数减1*/
if((fp=fopen("data.txt","wb"))==NULL)
{ printf("can not open\n");return;}
for(j=0;j<m;j++)/*将更改后的记录重新写入指定的磁盘文件中*/
if(fwrite(&stu[j] ,LEN,1,fp)!=1)
{ printf("can not save!\n");
getch();}
fclose(fp);
printf("delete successfully!\n");
}void search()/*自定义查找函数*/
{ FILE *fp;
int snum,i,m=0;
char ch[2];
if((fp=fopen("data.txt","rb"))==NULL)
{ printf("can not open\n");return;}
while(!feof(fp)) if(fread(&stu[m],LEN,1,fp)==1) m++;
fclose(fp);
if(m==0) {printf("no record!\n");return;}
printf("please input the number:");
scanf("%d",&snum);
for(i=0;i<m;i++)
if(snum==stu[i].num)/*查找输入的学号是否在记录中*/
{ printf("find the student,show?(y/n)");
scanf("%s",ch);
if(strcmp(ch,"Y")==0||strcmp(ch,"y")==0)
{
printf("number name elective experiment required sum\t\n");
printf(FORMAT,DATA);/*将查找出的结果按指定格式输出*/
break;
}
}
if(i==m) printf("can not find the student!\n");/*未找到要查找的信息*/
}void modify()/*自定义修改函数*/
{ FILE *fp;
int i,j,m=0,snum;
if((fp=fopen("data.txt","r+"))==NULL)
{ printf("can not open\n");return;}
while(!feof(fp))
if(fread(&stu[m],LEN,1,fp)==1) m++;
if(m==0) {printf("no record!\n"); fclose(fp); return; }
printf("please input the number of the student which do you want to modify!\n");
scanf("%d",&snum);
for(i=0;i<m;i++)
if(snum==stu[i].num)/*检索记录中是否有要修改的信息*/
break;
printf("find the student!you can modify!\n");
printf("name:\n");
scanf("%s",stu[i].name);/*输入名字*/
printf("\nelective:");
scanf("%lf",&stu[i].elec);/*输入选修课成绩*/
printf("\nexperiment:");
scanf("%lf",&stu[i].expe);/*输入实验课成绩*/
printf("\nrequired course:");
scanf("%lf",&stu[i].requ);/*输入必修课成绩*/
stu[i].sum=stu[i].elec+stu[i].expe+stu[i].requ;
if((fp=fopen("data.txt","wb"))==NULL)
{ printf("can not open\n");return;}
for(j=0;j<m;j++)
if(fwrite(&stu[j] ,LEN,1,fp)!=1)
{ printf("can not save!"); getch(); }
fclose(fp);
}void insert()
{ FILE *fp;
int i,j,k,m=0,snum;
if((fp=fopen("data.txt","r+"))==NULL)
{ printf("can not open\n");return;}
while(!feof(fp))
if(fread(&stu[m],LEN,1,fp)==1) m++;
if(m==0) {printf("no record!\n"); fclose(fp); return; }
printf("please input position where do you want to insert!(input the number)\n");
scanf("%d",&snum);
for(i=0;i<m;i++)
if(snum==stu[i].num)
break;
for(j=m-1;j>i;j--)
stu[j+1]=stu[j];
printf("now please input the new information.\n");
printf("number:");
scanf("%d",&stu[i+1].num);
for(k=0;k<m;k++)
if(stu[k].num==stu[i+1].num)
{
printf("the number is existing,press any to continue!");
getch();
fclose(fp);
return;
}
printf("name:\n");
scanf("%s",stu[i+1].name);
printf("\nelective:");
scanf("%lf",&stu[i+1].elec);
printf("\nexperiment:");
scanf("%lf",&stu[i+1].expe);
printf("\nrequired course:");
scanf("%lf",&stu[i+1].requ);
stu[i+1].sum=stu[i+1].elec+stu[i+1].expe+stu[i+1].requ;
if((fp=fopen("data.txt","wb"))==NULL)
{ printf("can not open\n");return;}
for(k=0;k<=m;k++)
if(fwrite(&stu[k] ,LEN,1,fp)!=1)
{ printf("can not save!"); getch(); }
fclose(fp);
}void total()
{ FILE *fp;
int m=0;
if((fp=fopen("data.txt","r+"))==NULL)
{ printf("can not open\n");return;}
while(!feof(fp))
if(fread(&stu[m],LEN,1,fp)==1)
m++;
if(m==0) {printf("no record!\n");fclose(fp);return;}
printf("the class are %d students!\n",m);
fclose(fp);
}

热心网友 时间:2023-10-15 23:36

有一个成绩管理的要不要?追问没有一些别的么😭😭

追答你要什么的?把你的需求说明白一些。

热心网友 时间:2023-10-15 23:36

我有的,see me id searching my qq.
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
在RLC电路中,谐振频率为___同期为___谐振条件为___? 电磁振荡并联 RLC振荡回路的谐振频率与振荡特性 佛手柑水培还是干放 中山市美派电器有限公司怎么样? 成都美派电器有限公司怎么样? 两条不同品牌的DDR3内存条可以一起用吗 驾驶证的牡丹卡多长时间能办下来 新衣服必须用洗衣液洗才能去甲醛吗? 梦见逛街被偷抢 2024年买什么品牌的运动男鞋比较好? 豪斯医生第八季14集 豪斯医生第八季15集 包装帽子 休闲帽 一般都用什么包装 是盒子还是透明袋~ 帽子应该不怕压吧 铃木ja11在哪里能买到 插入U盘后电脑自动重启 天梭1853t063618a11JA0320218这是表盘后面的字,这是天梭哪一款?价值多少钱_百度问一问 PIC单片机VPP高压编程是怎么回事,我用KIT3测VPP脚并没有13V输出呀。麻烦帮我解答一下。谢谢 用c++来写 有谁知道,维生素B族的每一个子民的功效,能治疗什么缺陷 这样的视频直传b站应该不会被压吧 天梭、11ja0723894型手表 开压吧 丁日傻脸最终终成正果的可能性有多大 学生信息管 有一瓶进口的咖啡。瓶盖上印着11 JA 14 HB 01:41 这过期了么?11是年份,还是14是年份啊? 压腿怎么有点不明白?不会是用手去压吧?怎样压腿能有效地拉开韧带? 维他命都有什么效用 美度舵手表背部11ja是什么意思 FR700绝缘片 这个红绿灯怎么过?白色实线不能压吧?怎么过,我就在这样的路线旁边 出现“PHP Warning: mysqli_fetch_array() expe”是什么原因啊? 蓬灰与面粉可以用机器压吧? 如何防止高温天气灭火器超压,一到夏天连续高温天气会造成一些灭火器超压吧,如何解决?请高人指点。 A lot of people as well as the president of the animal protection association ____________ expe... 最后的神迹怎么压br 解释解释压力吧? 压韧带上瘾了怎么办? 一个恒容密闭非真空的容器内充入稀有气体,大家都说压强不变,这里的压强应该是指原气体的分压吧 谁知道JD36-250闭式双点压力机,单柱冲压机JA11-250吨,THP27-500液压机,用的什么润滑油和一次添加量 白天睡觉的时候想醒醒不过来,也不是鬼压吧,梦里可以动就是动起来挺困难,要挣扎会,好不容易醒了还特别 有时会抽根烟想事情,不过很偶尔,每次抽完之后都会挺后悔,后悔不该抽烟,多年来一直没烟瘾,算是泄压吧 压力吧、累啊 《我的电竞男友心太黑》txt下载在线阅读全文,求百度网盘云资源 梦幻西游69级练级 梦幻西游69级怎么刷善恶点 把句子写具体:地板真滑呀 活力板怎么滑呀!!! 下雨天路上为什么会滑啊 HDYKHJzzmyfzqjk和dyzcnjdyx是中文开头的缩写,大家帮我想展开的意思 请问墨尔本鬼步舞是跳还是滑呀? 小学=年级看图写话过河小蜜蜂落水 安踏的鞋滑呀!怎么办