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

用C语言编写学生信息管理系统,十万火急!

发布网友 发布时间:2022-05-01 16:18

我来回答

1个回答

热心网友 时间:2022-06-19 10:13

可以参考
#include "stdio.h" /*I/O函数*/
#include "stdlib.h" /*其它说明*/
#include "string.h" /*字符串函数*/
#include "conio.h" /*屏幕操作函数*/
#include "mem.h" /*内存操作函数*/
#include "ctype.h" /*字符操作函数*/
#include "alloc.h" /*动态地址分配函数*/
struct score
{
int mingci;
char xuehao[8];
char mingzi[20];
float score[6];
}data,info[1000];
int i,j,k=0;
char temp[20],ch;
FILE *fp,*fp1;

void shuru()
{
if((fp=fopen("s_score.txt","ab+"))==NULL)
{
printf("cannot open this file.\n");
getch();exit(0);
}
for(i=0;i<=1000;i++)
{
printf("\nPlease shuru xuehao:");
gets(data.xuehao);
printf("Please shuru mingzi:");
gets(data.mingzi);
printf("Please shuru yuwen score:");
gets(temp);data.score[0]=atof(temp);
printf("Please shuru shuxue score:");
gets(temp);data.score[1]=atof(temp);
printf("Please input yingyu score:");
gets(temp);data.score[2]=atof(temp);
printf("Please shuru wuli score:");
gets(temp);data.score[3]=atof(temp);
printf("Please shur huaxue score:");
gets(temp);data.score[4]=atof(temp);
data.score[5]=data.score[0]+data.score[1]+data.score[2]+data.score[3]+data.score[4];
fwrite(&data,sizeof(data),1,fp);
printf("another?y/n");
ch=getch();
if(ch=='n'||ch=='N')
break;
} fclose(fp);
}
void xianshi()
{
float s;int n;
if((fp=fopen("s_score.txt","rb+"))==NULL)
{
printf("Cannot reading this file.\n");
exit(0);
}
for(i=0;i<=1000;i++)
{
if((fread(&info[i],sizeof(info[i]),1,fp))!=1)
break;
}
printf("\nxuehao mingzi yuwen shuxue yingyu wuli huauxue zhongfen\n");
for(j=0,k=1;j<i;j++,k++)
{
info[j].mingci=k;
printf("%6s %8s %3.1f %3.1f %3.1f %3.1f %3.1f %3.1f\n",info[j].xuehao,info[j].mingzi,info[j].score[0],info[j].score[1],info[j].score[2],info[j].score[3],info[j].score[4],
info[j].score[5]);
}
getch();
fclose(fp);
}

void xiugai()
{
if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)
{
printf("Cannot open this file.\n");
exit(0);
}
printf("\nPLease shuru xiugai xuehao:");
scanf("%d",&i); getchar();
while((fread(&data,sizeof(data),1,fp))==1)
{
j=atoi(data.xuehao);
if(j==i)
{
printf("xuehao:%s\nmingzi:%s\n",data.xuehao,data.mingzi);
printf("Please shuru mingzi:");
gets(data.mingzi);
printf("Please shuru yuwen score:");
gets(temp);data.score[0]=atof(temp);
printf("Please shuru shuxue score:");
gets(temp);data.score[1]=atof(temp);
printf("Please input yingyu score:");
gets(temp);data.score[2]=atof(temp);
printf("Please input wuli score:");
gets(temp);data.score[3]=atof(temp);
printf("Please input huaxue score:");
gets(temp);data.score[4]=atof(temp);
data.score[5]=data.score[0]+data.score[1]+data.score[2]+data.score[3]+data.score[4];

} fwrite(&data,sizeof(data),1,fp1);
}
fseek(fp,0L,0);
fseek(fp1,0L,0);
while((fread(&data,sizeof(data),1,fp1))==1)
{
fwrite(&data,sizeof(data),1,fp);
}

fclose(fp);
fclose(fp1);
}
void chazhao()
{
if((fp=fopen("s_score.txt","rb"))==NULL)
{
printf("\nCannot open this file.\n");
exit(0);
}
printf("\nPLease shuru xuehao chakan:");
scanf("%d",&i);
while(fread(&data,sizeof(data),1,fp)==1)
{
j=atoi(data.xuehao);
if(i==j)
{
printf("xuehao:%s mingzi:%s\nyuwen:%f\n shuxue:%f\n yingyu:%f\n wuli:%f\n huaxue:%f\n ",data.xuehao,data.mingzi,data.score[0],data.score[1],data.score[2],data.score[3],data.score[4],data.score[5]);
}getch();
}
}
void shanchu()
{
if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)
{
printf("\nopen score.txt was failed!");
getch();
exit(0);
}
printf("\nPlease input ID which you want to del:");
scanf("%d",&i);getchar();
while((fread(&data,sizeof(data),1,fp))==1)
{
j=atoi(data.xuehao);
if(j==i)
{

printf("Anykey will delet it.\n");
getch();
continue;
}
fwrite(&data,sizeof(data),1,fp1);
}
fclose(fp);
fclose(fp1);
remove("s_score.txt");
rename("temp.txt","s_score.txt");
printf("Data delet was succesful!\n");
printf("Anykey will return to main.");
getch();
}
main()
{
while(1)
{
clrscr(); /*清屏幕*/
gotoxy(1,1); /*移动光标*/
textcolor(YELLOW); /*设置文本显示颜色为**/
textbackground(BLUE); /*设置背景颜色为蓝色*/
window(1,1,99,99); /* 制作显示菜单的窗口,大小根据菜单条数设计*/
clrscr();
printf("*************welcome to use student manage******************\n");
printf("*************************menu********************************\n");
printf("* ========================================================= * \n");
printf("* 1>shuru 2>xiugai * \n");
printf("* 3>shanchu 4>chazhao * \n");
printf("* 5>xianshi 6>exit * \n");
printf("* * \n");
printf("* --------------------------------------------------------- * \n");
printf(" Please input which you want(1-6):");
ch=getch();
switch(ch)
{
case '1':shuru();break;
case '2':xiugai(); break;
case '3':shanchu(); break;
case '4':chazhao(); break;
case '5':xianshi(); break;
case '6':exit(0);
default: continue;
}
}
}
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
教案1和许多情感目标 斗牛电影讲的什么 小龙虾怎么做最好吃 这样做能让你吃个不停 蒜蓉小龙虾怎么做好吃?在家也能吃到美味的方法 在家怎么做出好吃又美味的小龙虾? 请问石家庄哪有成人教育? 石家庄尚拓教育怎么样机构靠谱吗 石家庄国华教育提升学历靠谱吗 抗阻训练训练方法 颈椎稳定性练习——等长抗阻训练 vivox27pro屏幕锁数字密码忘记,账户密码忘记,可以强制解开? 怎样用C语言制作学生信息管理系统 卡萨帝c33w1u1洗衣机电机是直驱还是皮带? 扮演《破坏之王》里的断水流大师兄的是谁? 破坏之王断水流谁演的 求C语言学生成绩管理系统代码。要能用的。 1996属鼠的女12月初九命好吗? 学生学籍管理系统c语言代码(急需,致谢!) 为什么人人都说大师兄SB 1972年属鼠的女人命运12月23日 女属鼠84年12月初九早晨7点左右生命运配偶 林国斌饰演过哪些角色? 周星驰电影破坏之王谁饰演 我不是针对谁我是说在座的各位都是垃圾 c语言学生成绩管理系统的代码 周星驰《破坏之王》中有哪些演员? (破坏之王)里的大师兄和(鼠胆龙威)里的医生的弟弟分别是谁演的 考驾照考的好痛苦,尤其是别人都过了我还在考。 华为手机设置电话黑名单 现在学车考驾照真的很难吗?我朋友科目二挂了两次了! 汽车上一般都有哪些传感器?它们的作用 用c语言编写学生管理系统, 雨量传感器与雨量感应式自动雨刮有何区别? 怎幺用打印机收发传真 急需一个用C语言编写的学生信息管理系统 打印机如何发送和接受传真? 什么是光学式雨量传感器 网上买的卡萨帝全国包安装吗 Docuprint CM305 df打印机怎么收传真 降雨量100毫米是什么意思 三星scx4521f 打印复印传真一体机怎么设置收传真? 阿里斯顿的老牌的热水器,这个按钮都是什么意思啊?(不管按啥都不加热) 洗面奶,爽肤水和乳液在日常的肌肤护理中都有独特的作用,虽然都很重要,但是哪个更重要? ariston热水器模式,一个循环标志、一个钟表的标志、一个月牙标志。各代表什么意思?哪个最省电。 阿里斯顿热水器面板上 P 表示什么? 用洗面奶洗完脸后,隔多长时间才能用爽肤水,然后又隔多长时间才能擦保湿乳液? 阿里斯顿热水器旁边的那个旋钮扭哪边是开的 阿里斯顿太阳能热水器使用说明 ariston热水器ti3机型面板说明 护肤的步骤 一般是:洗面乳--爽肤水---保湿乳 隔离霜一定要用吗?起到什么作用??我平时不化妆的