c语言课程设计 学生成绩管理系统

课程设计,基本不会,正在学,但是时间来不及了,希望有朋友帮帮忙。希望是各位以前自己做的课程设计,网上找不到的,好答案追加100分,只能追加100分了。。。。
要求是,学生成绩管理系统,使用C语言,源程序要有适当的注释,使程序容易阅读。按要求完成规定的功能,不同的功能使用不同的函数来完成。最好有完整的实验报告。
基本要求如下
数据录入:录入系统所需的数据,用链表或结构体数组组织数据2.数据存储:将录入的数据存储,用文件的形式将录入的数据存储3.数据读写:对数据进行读写操作,并进行读写操作4.数据修改:对数据进行更新操作,可以进行新数据的插入,旧数据的修改操作5.数据删除:对数据进行删除操作,根据具体题目将对应记录删除6.数据查询:按要求对数据进行查询,含简单查询及组合查询7.数据统计:按要求对数据进行统计,含简单统计及综合统计8.数据排序:按要求对数据进行排序,含升序排序及降序排序9.数据报表:按要求对数据打印报表,依规定的报表格式对数据打印报表10.界面:设计总体菜单界面,简单菜单、下拉式或弹出式11.密码设置:用户进入系统时,有不同用户名和密码的输入。请发到455033710@qq.com

第1个回答  2010-09-18
#include<fstream.h>
#include<process.h>
#include<iomanip.h>
#include<string.h>

class Student
{
public:
Student();
~Student();
void add_info();
void del_info();
void search_info_cell();
void out_all_info();
int get_info();
protected:
char name[10];
char sex[3];
char nationality[7];
char nation[8];
char diploma[6];
char birthday[8];
char address[6];
long cell;
long family;
long school;
int chinese,English,math,physics;
Student *head,*next;
};
/**
*构造函数,用来创建对象同时初始化相关指针变量
*/
Student::Student()
{
head=NULL;
next=NULL;
}
/**
*从文件中获取学生的信息
*/
int Student::get_info()
{
Student *temp,*loop;
temp=new Student();
loop=new Student();
ifstream out_file;
out_file.open("stuinfo.txt",ios::beg);//打开文件,设置读指针在文件的开头
if(!out_file)
{
cout<<"从文件中获取信息失败!";
cout<<"\n按任意键退出.";
cin.get();
exit(0);//结束程序
}
while(!out_file.eof())//循环读文件,直到读到了文件的末尾
{
//文件的结构是:文件的一行就是一个学生的信息, 从左到右是: 电话号 姓名 性别 民族 地址 国籍 学历 出生日期 语文 英语 数学 物理
//这些信息可以在本程序提供的功能生成并保存到文件里
out_file>>(temp->cell)>>(temp->name)>>(temp->sex)>>(temp->nation)>>(temp->address)>>(temp->nationality )>>
(temp->diploma)>>(temp->birthday)>>(temp->chinese)>>(temp->English)>>(temp->math)>>(temp->physics);
if(temp->cell==0) break;
//使用链表把学生的信息保存到内存中
if(head==NULL) head=temp;
else
{
if(head->cell>temp->cell)
{
temp->next=head;
head=temp;
}
else
{
loop=head;
while(loop->next!=NULL)
{
if(loop->next->cell>temp->cell)
{
temp->next=loop->next;
loop->next=temp;
break;
}
loop=loop->next;
}
if(loop->next==NULL)
{
loop->next=temp;
temp->next=NULL;
}
}
}
temp=new Student;
loop=new Student;
}
out_file.close();//关闭文件
if(head==NULL) return 0;
else return 1;
}

/**
*输出所有学生的信息
*/
void Student::out_all_info()
{
Student*temp;
temp=new Student;
cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
cout<<"学生信息如下:"<<endl<<endl;
cout<<setw(7)<<"电话"<<setw(7)<<"姓名"<<setw(5)<<"性别"<<setw(8)<<"民族"<<setw(8)<<"地址"<<setw(8)<<"国籍"<<setw(6)
<<"学历"<<setw(9)<<"生日"<<setw(5)<<"语文"<<setw(5)<<"英语"<<setw(5)<<"数学"<<setw(5)<<"物理"<<endl;
cout<<endl;
temp=head;
while(temp!=NULL)//循环读链表,输出所有学生的信息
{
cout<<setw(7)<<(temp->cell)<<setw(7)<<(temp->name)<<setw(5)<<(temp->sex)<<setw(8)<<(temp->nation)<<setw(8)<<(temp->address)<<setw(8)
<<(temp->nationality)<<setw(6)<<(temp->diploma)<<setw(9)<<(temp->birthday)<<setw(5)<<(temp->chinese)<<setw(5)<<(temp->English)
<<setw(5)<<(temp->math)<<setw(5)<<(temp->physics)<<endl<<endl;
temp=temp->next;
}
}
/**
*通过学号查找信息
*/
void Student::search_info_cell()
{
Student*temp;
long num;
temp=new Student;
cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
cout<<"输入要查找学生电话号码:";
cin>>num;//输入手机号
temp=head;
while(temp!=NULL&&temp->cell!=num)//比较学号
temp=temp->next;
if(temp==NULL)//没有找到信息
cout<<"对不起,没有这个学生!"<<endl;
else//输出信息
{
cout<<"学生信息如下: "<<endl;
cout<<setw(7)<<"电话"<<setw(7)<<"姓名"<<setw(5)<<"性别"<<setw(8)<<"民族"<<setw(8)<<"地址"<<setw(8)<<"国籍"<<setw(6)
<<"学历"<<setw(9)<<"生日"<<setw(5)<<"语文"<<setw(5)<<"英语"<<setw(5)<<"数学"<<setw(5)<<"物理"<<endl;
cout<<setw(7)<<(temp->cell)<<setw(7)<<(temp->name)<<setw(5)<<(temp->sex)<<setw(8)<<(temp->nation)<<setw(8)<<(temp->address)<<setw(8)
<<(temp->nationality)<<setw(6)<<(temp->diploma)<<setw(9)<<(temp->birthday)<<setw(5)<<(temp->chinese)<<setw(5)<<(temp->English)
<<setw(5)<<(temp->math)<<setw(5)<<(temp->physics)<<endl;
}
}
/**
*增加学生的信息
*/
void Student::add_info()
{
Student *temp,*loop,*loop1;
temp=new Student;
loop=new Student;
loop1=new Student;
cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
cout<<"现在增加学生信息:"<<endl;
{ cout<<"输入电话号码:";
cin>>temp->cell;//输入手机号
cout<<"输入姓名:";
cin>>temp->name;//姓名
cout<<"输入性别:";
cin>>temp->sex;
cout<<"输入民族:";
cin>>temp->nation;
cout<<"输入地址:";
cin>>temp->address;
cout<<"输入国籍:";
cin>>temp->nationality;
cout<<"输入学历:";
cin>>temp->diploma;
cout<<"输入生日:";
cin>>temp->birthday;
cout<<"输入语文分数:";
cin>>temp->chinese;//语文
cout<<"输入英语分数:";
cin>>temp->English;//英语
cout<<"输入数学分数:";
cin>>temp->math;//数学
cout<<"输入物理分数:";
cin>>temp->physics;//物理
if(head==NULL) head=temp;//将信息添加到链表中
else
{
if(head->cell>temp->cell)
{
temp->next=head;
head=temp;
}
else
{
loop=head;
while(loop->next!=NULL)
{
if(loop->next->cell>temp->cell)
{
temp->next=loop->next;
loop->next=temp;
break;
}
loop=loop->next;
}
if(loop->next==NULL)
{
loop->next=temp;
temp->next=NULL;
}
}
}
}
cout<<"\n您输入学生信息如下:"<<endl;
cout<<setw(7)<<"手机"<<setw(7)<<"姓名"<<setw(5)<<"性别"<<setw(8)<<"民族"<<setw(8)<<"地址"<<setw(8)<<"国籍"<<setw(6)
<<"学历"<<setw(9)<<"生日"<<setw(5)<<"语文"<<setw(5)<<"英语"<<setw(5)<<"数学"<<setw(5)<<"物理"<<endl;
cout<<setw(7)<<(temp->cell)<<setw(7)<<(temp->name)<<setw(5)<<(temp->sex)<<setw(8)<<(temp->nation)<<setw(8)<<(temp->address)<<setw(8)
<<(temp->nationality)<<setw(6)<<(temp->diploma)<<setw(9)<<(temp->birthday)<<setw(5)<<(temp->chinese)<<setw(5)<<(temp->English)
<<setw(5)<<(temp->math)<<setw(5)<<(temp->physics)<<endl;
}
/**
*通过学号删除信息
*/
void Student::del_info()
{
Student *temp,*loop1,*loop2;
long cell;
temp=new Student;
loop1=new Student;
loop2=new Student;
cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
cout<<"输入要删除学生电话号码:";
cin>>cell;//输入电话号
temp=head;
while(temp!=NULL&&temp->cell!=cell)//通过手机号查找信息
{
loop1=temp;
temp=temp->next;
}
if(temp==NULL)//没有相应学号的学生信息
cout<<"抱歉,没有该学生!"<<endl;
else
{
loop1->next=temp->next;//跳过链表的一个节点temp
cout<<"您删除的学生信息如下:"<<endl;
cout<<setw(7)<<"手机"<<setw(7)<<"姓名"<<setw(5)<<"性别"<<setw(8)<<"民族"<<setw(8)<<"地址"<<setw(8)<<"国籍"<<setw(6)
<<"学历"<<setw(9)<<"生日"<<setw(5)<<"语文"<<setw(5)<<"英语"<<setw(5)<<"数学"<<setw(5)<<"物理"<<endl;
cout<<setw(7)<<(temp->cell)<<setw(7)<<(temp->name)<<setw(5)<<(temp->sex)<<setw(6)<<(temp->nation)<<setw(8)<<(temp->address)<<setw(8)
<<(temp->nationality)<<setw(6)<<(temp->diploma)<<setw(9)<<(temp->birthday)<<setw(5)<<(temp->chinese)<<setw(5)<<(temp->English)
<<setw(5)<<(temp->math)<<setw(5)<<(temp->physics)<<endl;
if(temp->cell==head->cell) head=head->next;
}
}
/**
*析构函数,只用程序的正常结束才会执行改函数,并且把学生的信息保存到文件中
*/
Student::~Student()
{
Student*temp;
temp=new Student;
ofstream write_file;
write_file.open("stuinfo.txt",ios::beg);
if(!write_file)
{
cout<<"信息写入文件失败!"<<endl;
cout<<"按任意键退出.";
cin.get();
exit(0);
}
temp=head;
while(temp!=NULL)
{
write_file<<temp->cell<<" "<<temp->name<<" "<<temp->sex<<" "<<temp->nation<<" "<<temp->address<<" "<<temp->nationality<<" "<<
temp->diploma<<" "<<temp->birthday<<" "<<temp->chinese<<" "<<temp->English<<" "<<temp->math<<" "<<temp->physics<<endl;
temp=temp->next;
}
write_file<<0;
write_file.close();
}
/**
*主函数,主要提供一些菜单选项
*/
void main()
{
char select;
int selection;
Student student;
cout<<"\n○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●"<<endl;
if(student.get_info()==0)
{
cout<<"文件中没有信息"<<endl;
cout<<"您想添加学生信息吗?(Y/N):";
cin>>select;
if(select=='y'||select=='Y')
student.add_info();
else exit(0);
}
cout<<" ________________________________"<<endl;
cout<<" |★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★|"<<endl;
cout<<" |☆| ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄|☆|"<<endl;
cout<<" |★| 学生信息选项如下 |★|"<<endl;
cout<<" |□|____________________________|□|"<<endl;
cout<<" |☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆|"<<endl;
cout<<" |□| ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄|□|"<<endl;
cout<<" |★| 输入 1 通过学号查询 |★|"<<endl;
cout<<" |☆| 输入 2 添加学生信息到文件 |☆|"<<endl;
cout<<" |★| 输入 3 从文件中删除信息 |★|"<<endl;
cout<<" |☆| 输入 4 浏览所有学生信息 |☆|"<<endl;
cout<<" |★| 输入任意键退出 |★|"<<endl;
cout<<" |☆|____________________________|☆|"<<endl;
cout<<" |★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★|"<<endl;
cout<<"  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄"<<endl;
cout<<"请输入选项:";
cin>>selection;
while(selection>=1&&selection<=4)
{
if(selection==1) student.search_info_cell();
if(selection==2) student.add_info();
if(selection==3) student.del_info();
if(selection==4) student.out_all_info();
cout<<" ________________________________"<<endl;
cout<<" |★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★|"<<endl;
cout<<" |☆| ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄|☆|"<<endl;
cout<<" |★| 学生信息选项如下 |★|"<<endl;
cout<<" |□|____________________________|□|"<<endl;
cout<<" |☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆|"<<endl;
cout<<" |□| ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄|□|"<<endl;
cout<<" |★| 输入 1 通过学号查询 |★|"<<endl;
cout<<" |☆| 输入 2 添加学生信息到文件 |☆|"<<endl;
cout<<" |★| 输入 3 从文件中删除信息 |★|"<<endl;
cout<<" |☆| 输入 4 浏览所有学生信息 |☆|"<<endl;
cout<<" |★| 输入任意键退出 |★|"<<endl;
cout<<" |☆|____________________________|☆|"<<endl;
cout<<" |★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★|"<<endl;
cout<<"  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄"<<endl;
cout<<"请输入选项:";
cin>>selection;
}
}本回答被网友采纳
第2个回答  2010-09-15
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
#define N 3
typedef struct z1
{
char no[11];
char name[15];
int score[N];
float sum;
float average;
int order;
struct z1 *next;
}STUDENT;
STUDENT *init();
STUDENT *create();
STUDENT *del(STUDENT *h);
void print(STUDENT *h);
void search1(STUDENT *h);
void search2(STUDENT *h);
STUDENT *insert(STUDENT *h);
void sort(STUDENT *h);
void save(STUDENT *h);
void tongji(STUDENT *h);
int menu_select();
STUDENT *load();
void inputs(char *prompt,char *s,int count);
STUDENT *load();
main()
{
int i;
STUDENT *head;
head=init();
for(;;)
{
switch(menu_select())
{
case 0:head=init();break;
case 1:head=create();break;
case 2:head=insert(head);break;
case 3:save(head);break;
case 4:print(head);break;
case 5:search1(head);break;
case 6:head=del(head);break;
case 7:sort(head);break;
case 8:tongji(head);break;
case 9:search2(head);break;
case 10:exit(0);
}
}
}
int menu_select()
{
char *menu[]={"************菜单************",
"0. 初始化链表",
"1. 输入学生成绩",
"2. 插入学生成绩",
"3. 保存学生记录",
"4. 显示学生记录",
"5. 按学号查找学生信息",
"6. 删除指定学号的学生信息",
"7. 按某一门课对学生成绩排序",
"8. 统计某门课程的学生成绩",
"9. 按姓名查找学生信息",
"10. 退出系统"};
char s[3];
int c,i;
for(i=0;i<=11;i++)
printf(" %s\n",menu[i]);
do
{
printf("\n请选择0~10中的某一个选项\n");
scanf("%s",s);
c=atoi(s);
}while(c<0||c>10);
return c;
}
STUDENT *init()
{
return NULL;
}
STUDENT *create()
{
int i;int s;
STUDENT *h=NULL,*info;
for(;;)
{
info=(STUDENT *)malloc(sizeof(STUDENT));
if(!info)
{
printf("\n内存不足");
return NULL;
}
inputs("输入学号:",info->no,11);
if(info->no[0]=='@')break;
inputs("输入姓名:",info->name,15);
printf("开始输入%d门课的成绩\n",N);
s=0;
for(i=0;i<N;i++)
{
do{
printf("第%d门分数:",i+1);
scanf("%d",&info->score[i]);
if(info->score[i]>100||info->score[i]<0)
printf("输入成绩错误,请重新输入:\n");
}while(info->score[i]>100||info->score[i]<0);
s=s+info->score[i];
}
info->sum=s;
info->average=(float)s/N;
info->order=0;
info->next=h;
h=info;
}
return h;
}
void inputs(char *prompt,char *s,int count)
{
char p[255];
do
{
printf(prompt);
scanf("%s",p);
if(strlen(p)>count)
printf("\n太长了!\n");
}while(strlen(p)>count);
strcpy(s,p);
}
void print(STUDENT *h)
{
int i=0;
STUDENT *p;
p=h;
printf("\n\n\n***********************学生***********************\n");
printf("|序号|学号 | 姓名 | 语文 | 英语 |数学 | 总分 |平均分 |名次 |\n");
printf("|---|-------|--------|----|----|----|------|------|---|\n");
while(p!=NULL)
{
i++;
printf("|%3d |%-10s|%-8s|%4d|%4d|%4d|%4.2f|%4.2f|%3d|\n",i,p->no,p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
p=p->next;
}
printf("***********************end***********************\n");
}
STUDENT *del(STUDENT *h)
{
STUDENT *p,*q;
char s[11];
printf("请输入要删除的学生的学号\n");
scanf("%s",s);
q=p=h;
while(strcmp(p->no,s)&&p!=NULL)
{
q=p;
p=p->next;
}
if(p==NULL)
printf("\n链表中没有学号为%s的学生\n",s);
else
{
printf("\n\n\n***********************找到了***********************\n");
printf("|学号 | 姓名 | 语文 | 英语 | 数学 | 总分 | 平均分 | 名次 |\n");
printf("|----------|----------|----|----|----|------|------|---|\n");
printf("|%-10s|%-8s|%4d|%4d|%4d|%4.2f|%4.2f|%3d|\n",p->no,p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
printf("***********************end***********************\n");
printf("请按任意键删除\n");
getchar();
if(p==h)
h=p->next;
else q->next=p->next;
free(p);
printf("\n已经删除学号为%s的学生\n",s);
printf("不要忘了保存数据\n");
}
return h;
}
void search1(STUDENT *h)
{
STUDENT *p;
char s[11];
printf("请输入你要查找的同学的学号\n");
scanf("%s",s);
p=h;
while(strcmp(p->no,s)&&p!=NULL)
p=p->next;
if(p==NULL)
printf("'n没有学号为%s的学生\n",s);
else
{
printf("\n\n\n***********************找到了***********************\n");
printf("|学号 | 姓名 | 语文 | 英语 | 数学 | 总分 | 平均分 | 名次 |\n");
printf("|----------|-----------|----|----|----|------|------|---|\n");
printf("|%-10s|%-8s|%4d|%4d|%4d|%4.2f|%4.2f|%3d|\n",p->no,p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
printf("***********************end***********************\n");
}
}
void search2(STUDENT *h)
{
STUDENT *p;
char s[11];
printf("请输入你要查找的同学的姓名\n");
scanf("%s",s);
p=h;
while(strcmp(p->name,s)&&p!=NULL)
p=p->next;
if(p==NULL)
printf("\n没有姓名为%s的学生\n",s);
else
{
printf("\n\n\n***********************找到了***********************\n");
printf("|学号 | 姓名 | 语文 | 英语 | 数学 | 总分 | 平均分 | 名次 |\n");
printf("|----------|-----------|----|----|----|------|------|---|\n");
printf("|%-10s|%-8s|%4d|%4d|%4d|%4.2f|%4.2f|%3d|\n",p->no,p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
printf("***********************end***********************\n");
}
}
STUDENT *insert(STUDENT *h)
{
STUDENT *p,*q,*info;
char s[11];
int s1,i;
printf("请输入插入点的学生学号\n");
scanf("%s",s);
printf("\n请输入新的学生信息\n");
info=(STUDENT *)malloc(sizeof(STUDENT));
if(!info)
{
printf("\n内存不足!");
return NULL;
}
inputs("输入学号:",info->no,11);
inputs("输入姓名:",info->name,15);
printf("请输入%d门课的分数\n",N);
s1=0;
for(i=0;i<N;i++)
{
do{
printf("分数%d",i+1);
scanf("%d",&info->score[i]);
if(info->score[i]>100||info->score[i]<0)
printf("输入数据有误,请重新输入\n");
}while(info->score[i]>100||info->score[i]<0);
s1=s1+info->score[i];
}
info->sum=s1;
info->average=(float)s1/N;
info->order=0;
info->next=NULL;
p=h;
q=h;
while(strcmp(p->no,s)&&p!=NULL)
{q=p;p=p->next;}
if(p==NULL)
if(p==h)
h=info;
else q->next=info;
else
if(p==h)
{
info->next=p;
h=info;
}
else
{
info->next=p;
q->next=info;
}
printf("\n已经插入了%s这个学生\n",info->name);
printf("----不要忘了存盘啊--\n");
return(h);
}
void save(STUDENT *h)
{
FILE *fp;
STUDENT *p;
char outfile[10];
printf("请输入保存文件的文件名,例如 c:\\f1\\te.txt:\n");
scanf("%s",outfile);
if((fp=fopen(outfile,"wb"))==NULL)
{
printf("不能打开文件\n");
exit(1);
}
printf("\n正在保存......\n");
p=h;
while(p!=NULL)
{
fwrite(p,sizeof(STUDENT),1,fp);
p=p->next;
}
fclose(fp);
printf("------保存成功!!!------\n");
}
void sort(STUDENT *h)
{
int i=0,j;
STUDENT *p,*q,*t,*h1;
printf("请输入要按哪门课程的编号来排序:(0.语文 1.数学 2.英语)\n");
scanf("%d",&j);
h1=h->next;
h->next=NULL;
while(h1!=NULL)
{
t=h1;
h1=h1->next;
p=h;
q=h;
while(t->score[j]<p->score[j]&&p!=NULL)
{
q=p;
p=p->next;
}
if(p==q)
{
t->next=p;
h=t;
}
else
{
t->next=p;
q->next=t;
}
}
p=h;
while(p!=NULL)
{
i++;
p->order=i;
p=p->next;
}
print(h);
printf("排序成功!!!\n");
}
void tongji(STUDENT *h)
{
STUDENT *p;
int a,b,i;
printf("请输入课程编号\n");
scanf("%d",&i);
printf("请输入分数段:\n");
scanf("%d,%d",&a,&b);
p=h;
while(p!=NULL)
{
printf("\n\n\n***********************找到了***********************\n");
if(p->score[i]>=a&&p->score[i]<=b)
{
printf("|学号 | 姓名 | 语文 | 英语 | 数学 | 总分 | 平均分 | 名次 |\n");
printf("|--------|---------|----|----|----|------|------|---|\n");
printf("|%-10s|%-8s|%4d|%4d|%4d|%4.2f|%4.2f|%3d|\n",p->no,p->name,p->score[0],p->score[1],p->score[2],p->sum,p->average,p->order);
}
p=p->next;
}
printf("***********************end***********************\n");
}
第3个回答  2010-09-14
兄弟,这是要钱的,不是分就可以的
第4个回答  2010-09-15
,加你,了
第5个回答  2010-09-14
不会。

参考资料:

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网