求学生管理系统C语言程序

[复制链接]
查看11 | 回复1 | 2011-5-15 03:39:05 | 显示全部楼层 |阅读模式
回复

使用道具 举报

千问 | 2011-5-15 03:39:05 | 显示全部楼层
include\"stdio.h\"/*I/O函数*/
#include\"stdlib.h\"/*其它说明*/
#include\"string.h\"/*字符串函数*/
#include\"conio.h\"/*屏幕操作函数*/
#include\"mem.h\"/*内存操作函数*/
#include\"ctype.h\"/*字符操作函数*/
#include\"alloc.h\"/*动态地址分配函数*/
structscore
{
intmingci;
charxuehao[8];
charmingzi[20];
floatscore[6];
}data,info[1000];
inti,j,k=0;
chartemp[20],ch;
FILE*fp,*fp1;

voidshuru()
{
if((fp=fopen(\"s_score.txt\",\"ab\"))==NULL)
{
printf(\"cannotopenthisfile.\\n\");
getch();exit(0);
}
for(i=0;i=1000;i)
{
printf(\"\\nPleaseshuruxuehao:\");
gets(data.xuehao);
printf(\"Pleaseshurumingzi:\");
gets(data.mingzi);
printf(\"Pleaseshuruyuwenscore:\");
gets(temp);data.score[0]=atof(temp);
printf(\"Pleaseshurushuxuescore:\");
gets(temp);data.score[1]=atof(temp);
printf(\"Pleaseinputyingyuscore:\");
gets(temp);data.score[2]=atof(temp);
printf(\"Pleaseshuruwuliscore:\");
gets(temp);data.score[3]=atof(temp);
printf(\"Pleaseshurhuaxuescore:\");
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(
printf(\"another?y/n\");
ch=getch();
if(ch==\'n\'||ch==\'N\')
break;
}fclose(fp);
}
voidxianshi()
{
floats;intn;
if((fp=fopen(\"s_score.txt\",\"rb\"))==NULL)
{
printf(\"Cannotreadingthisfile.\\n\");
exit(0);
}
for(i=0;i=1000;i)
{
if((fread(
}
printf(\"\\nxuehaomingziyuwenshuxueyingyuwulihuauxuezhongfen\\n\");
for(j=0,k=1;ji;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);
}

voidxiugai()
{
if((fp=fopen(\"s_score.txt\",\"rb\"))==NULL||(fp1=fopen(\"temp.txt\",\"wb\"))==NULL)
{
printf(\"Cannotopenthisfile.\\n\");
exit(0);
}
printf(\"\\nPLeaseshuruxiugaixuehao:\");
scanf(\"%d\",getchar();
while((fread(
if(j==i)
{
printf(\"xuehao:%s\\nmingzi:%s\\n\",data.xuehao,data.mingzi);
printf(\"Pleaseshurumingzi:\");
gets(data.mingzi);
printf(\"Pleaseshuruyuwenscore:\");
gets(temp);data.score[0]=atof(temp);
printf(\"Pleaseshurushuxuescore:\");
gets(temp);data.score[1]=atof(temp);
printf(\"Pleaseinputyingyuscore:\");
gets(temp);data.score[2]=atof(temp);
printf(\"Pleaseinputwuliscore:\");
gets(temp);data.score[3]=atof(temp);
printf(\"Pleaseinputhuaxuescore:\");
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(
}
fseek(fp,0L,0);
fseek(fp1,0L,0);
while((fread(
}

fclose(fp);
fclose(fp1);
}
voidchazhao()
{
if((fp=fopen(\"s_score.txt\",\"rb\"))==NULL)
{
printf(\"\\nCannotopenthisfile.\\n\");
exit(0);
}
printf(\"\\nPLeaseshuruxuehaochakan:\");
scanf(\"%d\",
while(fread(
if(i==j)
{
printf(\"xuehao:%smingzi:%s\\nyuwen:%f\\nshuxue:%f\\nyingyu:%f\\nwuli:%f\\nhuaxue:%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();
}
}
voidshanchu()
{
if((fp=fopen(\"s_score.txt\",\"rb\"))==NULL||(fp1=fopen(\"temp.txt\",\"wb\"))==NULL)
{
printf(\"\\nopenscore.txtwasfailed!\");
getch();
exit(0);
}
printf(\"\\nPleaseinputIDwhichyouwanttodel:\");
scanf(\"%d\",getchar();
while((fread(
if(j==i)
{

printf(\"Anykeywilldeletit.\\n\");
getch();
continue;
}
fwrite(
}
fclose(fp);
fclose(fp1);
remove(\"s_score.txt\");
rename(\"temp.txt\",\"s_score.txt\");
printf(\"Datadeletwassuccesful!\\n\");
printf(\"Anykeywillreturntomain.\");
getch();
}
main()
{
while(1)
{
clrscr();/*清屏幕*/
gotoxy(1,1);/*移动光标*/
textcolor(YELLOW);/*设置文本显示颜色为黄色*/
textbackground(BLUE);/*设置背景颜色为蓝色*/
window(1,1,99,99);/*制作显示菜单的窗口,大小根据菜单条数设计*/
clrscr();
printf(\"*************welcometousestudentmanage******************\\n\");
printf(\"*************************menu********************************\\n\");
printf(\"*=========================================================*\\n\");
printf(\"*1shuru2xiugai*\\n\");
printf(\"*3shanchu4chazhao*\\n\");
printf(\"*5xianshi6exit*\\n\");
printf(\"**\\n\");
printf(\"*---------------------------------------------------------*\\n\");
printf(\"Pleaseinputwhichyouwant(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;
}
}
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行