| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 984 人关注过本帖
标题:[原创]关于学生成绩查询修改的程序
取消只看楼主 加入收藏
xw2014
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2006-1-17
收藏
 问题点数:0 回复次数:1 
[原创]关于学生成绩查询修改的程序
     定义一个班的学生(不多于100),包括姓名,学号,性别,输入学号或者姓名就可以得到他的成绩(语文,数学,外语,总分,均分),并且可以修改,这个程序应该是怎么样的思路呢 ?谢谢大家!
搜索更多相关主题的帖子: 学生 查询 
2006-03-28 22:10
xw2014
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2006-1-17
收藏
得分:0 

这是我写的,不过还有错误,不能编译通过。我刚学,很多都不会,希望大家多多指教!
/* student_score.c */
#define max 100

#include "stdio.h"
#include "conio.h"

struct date
{
float chinese;
float math;
float english;
float computer;
float summary;
float average;
}

struct student
{
int number;
char name[20];
char sex;
struct date score;
}student[max],*point;


print_information(int i)
{
printf("%d %c %s:\nchinese:%f english:%f computer:%f summary:%f average:%f\n",student[i].number,student[i].sex,student[i].name,student[i].score.chinese,student[i].score.math,student[i].score.english,student[i].score.computer,student[i].score.summary,student[i].score.average);
}


scanf_information(int i)
{
printf("please input the student's number:");
scanf("%d",&student[i].number);
printf("\nplease input the student's sex:");
scanf("%c",&student[i].sex);
printf("\nplease input the student's name:");
scanf("%s",student[i].name);
printf("\nplease input the score of chinese,math,english and computer:");
scanf("%f,%f,%f",&student[i].score.chinese,&student[i].score.math,&student[i].score.english,&student[i].score.computer);
student[i].score.summary=student[i].score.chinese+student[i].score.math+student[i].score.english+student[i].score.computer;
student[i].sco e.average=student[i].score.summary/4.0;
}

void bubblesort(int *point,int index)
{
int i,j;
int temp;
int change;
while(!change)
{
change=1;
for(j=index;j>0;j--)
for(i=0;i<j-1;i++)
if(point[i]>point[i+1])
{temp=point[i+1];
point[i+1]=point[i];
point[i]=temp;
change=0;
}
}
}


main()
{
int biaohao;
int i,selection;
int counter;
printf("please input the number of student:");
scanf("%d",&count);
if(count>=100)
printf("please input a number less than 100");
else
{
printf("please input the student's information:\n");
for(i=0;i<counter;i+=)
scanf_information(i);
bubblesort(student *point,count);
printf("\nfinal sorting result:");
for(i=0;i<counter;i++)
print_information(i);
printf("if you choose 1.Display student information\n");
printf("if you choose 2.Modify student information\n");
printf("if you choose 3 will quit\n");
printf("please input your choose:");
scanf("%d",&selection);

if(selection==1||selection==2)
{
printf("please input the student number:");
scanf("%d",&biaohao);
if(biaohao<100)
printf_information(biaohao);
else
{printf("the error student number!:");
printf("please input again\n");
}
}

swith(selection)
{case 1:break;
case 2:printf("please input the student's information:\n");
scanf_information(bianhao);
student[counter].score.chinese=student[biaohao].score.chinese;
student[counter].score.math=student[biaohao].score.math;
student[counter].score.english=student[biaohao].score.english;
student[counter].score.computer=student[biaohao].score.computer;
student[counter].score.summary=student[biaohao].score.summary;
student[counter].score.average=student[biaohao].score.average;
break;
case 3:break;
}
}
}


2006-03-30 22:50
快速回复:[原创]关于学生成绩查询修改的程序
数据加载中...
 
   



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

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