| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 6712 人关注过本帖
标题:小女就要交作业了.学生成绩管理系统.大家帮帮忙好吗?我都要哭出来了..
只看楼主 加入收藏
yk87458410
Rank: 1
等 级:新手上路
帖 子:65
专家分:0
注 册:2005-9-26
收藏
得分:0 
我有个现成的,不过功能比你这少几个你要不要.

2005-10-17 23:00
shangjk520
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-1-5
收藏
得分:0 
不错。。。
2006-01-05 13:57
cainiaoyihao
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2005-12-29
收藏
得分:0 

给你一个先凑合着用吧

#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;
}
}
}


2006-01-05 14:15
asqw
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-1-6
收藏
得分:0 
so easy~!
2006-01-06 11:03
modern_roc
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2006-4-19
收藏
得分:0 
兄弟,太厉害。。。<br><br>
佩服。。。。。<br><br>
顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶<br><br>
顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶<br><br>

┣☆等待英雄,我就是那条龙。
2006-04-28 01:50
诸神的黄昏
Rank: 1
等 级:新手上路
帖 子:38
专家分:0
注 册:2006-4-27
收藏
得分:0 

自己的事情自己动手做哈~

2006-04-28 08:23
xufeng917
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2006-12-8
收藏
得分:0 
scanf : floating point formats not linked
Abnormal program termination
错误信息上说的很清楚了啊
? 你不会不认识英语吧

2006-12-15 23:38
neverTheSame
Rank: 3Rank: 3
来 自:江西农业大学
等 级:新手上路
威 望:9
帖 子:1511
专家分:0
注 册:2006-11-24
收藏
得分:0 

#include<malloc.h>
#include<stdio.h>
#include<conio.h>
#define NULL 0
#define LEN sizeof(struct student)

struct student
{long num;
float score;
struct student * next;
};
int n;

struct student * creat(void)/*定义函数增加,返回一个带指向链表头的指针*/
{struct student * head,* p1,*p2;
float temp=0;
n=0;
p1=p2=(struct student *)malloc(LEN);/*开辟一个新单元*/
/*scanf("%ld,%f",&p1->num,&p1->score);*/
scanf("%ld",&p1->num);
scanf("%f",&temp);
p1->score=temp;

head=NULL;
while(p1->num!=0)
{n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student * )malloc(LEN);
/*scanf("%ld,%f",&p1->num,&p1->score);*/
scanf("%ld",&p1->num);
scanf("%f",&temp);
p1->score=temp;

}
p2->next=NULL;
return(head);
}

void print(struct student * head)/*此函数的功能是输出链表*/
{struct student * p;
printf("\nNow,These %d records are:\n",n);
p=head;
if(head!=NULL)
do
{printf("%ld,%5.1f\n",p->num,p->score);
p=p->next;
}while(p!=NULL);

}

struct student * del(struct student * head,long num)/*此函数是删除一个接点*/
{struct student * p1,* p2;
if(head==NULL){printf("\nList null!!\n"); }/*这个end到底是怎么回师?*/
p1=head;
while(num!=p1->num && p1->next!=NULL)
{p2=p1;p1=p1->next;
}/*p1向后移动一个接点*/

if(num==p1->num)/*找到了*/
{if(p1==head) head=p1->next;/*p1指向的是第一个接点,把第二个接点地址赋给head*/
else p2->next=p1->next;/*否则把下一个地址赋给前一个地址*/
printf("delete:%ld\n",num);
n=n-1;
}
else printf("%ld not been found!!\n",num);/*输出找不到该接点*/
return(head);
}

struct student * insert(struct student * head,struct student * stud)/*此函数的作用是插入一个结点*/
{struct student * p0,* p1,* p2;
p1=head; /*使p1指向第一个接点*/
p0=stud; /*p0指向要插入的接点*/
if(head==NULL)
{head=p0;p0->next=NULL;}/*使p0指向的接点作为头接点*/
else
{while((p0->num>p1->num)&&(p1->next!=NULL))
{p2=p1; /*使p2指向刚才p1指向的结点*/
p1=p1->next;
} /*p1后移一个结点*/
if(p0->num<p1->num)
{if(head==p1) head=p0;/*插入到原来的第一个结点之前*/
else p2->next=p0; /*插入到p2指向的结点之后*/
p0->next=p1;
}
else{p1->next=p0;p0->next=NULL;}/*插入到最后的结点之后*/
}
n=n+1;
return(head);
}

main()
{
struct student * head,* stu;
long del_num;
clrscr();/*清屏*/
printf("input records: \n");
head=creat();/*调用creat函数*/
print(head);/*调用print函数*/
printf("\ninput the deleted number:");
scanf("%ld",&del_num);
while(del_num!=0)
{head=del(head,del_num);
print(head);
printf("input the deleted number:");
scanf("%ld",&del_num);
}
printf("\ninput the inserted record:");
stu=(struct student *)malloc(LEN);
scanf("%ld",&stu->num);
scanf("%f",&stu->score);
while(stu->num!=0)
{head=insert(head,stu);
print(head);
printf("input the inserted record:");
free(stu);/*得记申请空间要释放,因stu所指的空间还在。*/
stu=(struct student * )malloc(LEN);
scanf("%ld",&stu->num);
scanf("%f",&stu->score);
}
getch();/*停顿*/
free(stu);
} /*你还没定义一个释放所有空间的函数*/

/*我的测试数据为:
input records:
201 11.0
202 21.0
203 41.0
204 14.0
0 0

Now,These 4 records are:
201, 11.0
202, 21.0
203, 41.0
204, 14.0

input the deleted number:0

input the inserted record:206 14.0

Now,These 5 records are:
201, 11.0
202, 21.0
203, 41.0
204, 14.0
206, 14.0
input the inserted record:0 0

*/


wap酷禾网(http://wap.),提供免费的、优质的、快捷的wap资源下载服务。
2006-12-16 01:24
huzengyu
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2006-11-20
收藏
得分:0 

给我发E-mail 我给你原代码~~


2006-12-16 09:29
lxase
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-7-20
收藏
得分:0 
做做试试呀
2006-12-16 13:20
快速回复:小女就要交作业了.学生成绩管理系统.大家帮帮忙好吗?我都要哭出来了..
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023802 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved