C语言课程设计:学生学籍管理系统。有谁有代码给我做个参考吗?谢谢了,C语言和C++的都可以。

实验模块:
1:实现学生基本情况的录入,修改,删除等基本操作。
2:对学生的基本信息提供灵活的查询方式。
3:完成一个班级的学期选课功能。
4:实现学生成绩的录入修改和删除等操作。
5:能方便的对学生的各个学期的成绩进行查询。
6:具有成绩统计,排名等功能。
7:具有留级,休学等特殊情况的处理功能。
8:能输出常用的各种表,课程表,成绩单等。
9:具有数据备份和数据恢复功能。
要求:
1:学生成绩表的设计要考虑到不同年级教学计划的变化情况。
2:对于新生班级,应该首先进行基本的情况的录入,选课,然后才能进行成绩的录入。

#include<stdio.h>
#include<string.h>
#include<stdlib.h>

typedef struct stud //学生信息结构
{
long num;
char name[20];
float score;
}Stud;

typedef struct node
{
Stud student;
struct node *next;
}Node;
Node *head=NULL;
void read(void);
void inser(long b);
void print();
void find(long b);
void searchname(char *s);
Node * del(long n);
void sort(int flag);
void menu();

void main()
{
char choose;
int flag=1;

while (flag)
{
menu(); //调用功能菜单函数,显示菜单项。
printf(" 请选择:");
choose=getchar();

switch(choose)
{ 1
case '1': read(); //调用建立链表的函数;输出链表信息;
print();
printf("\nPress any key Continue ");
//getchar();
getchar();
break;
case '2': //调用按学号查找学生信息的函数;并输出查找结果信息;
long c;
printf("input the number you want to find:");
scanf("%ld",&c);
find(c);
printf("\nPress any key Continue.");
getchar();
break;
case '3':
//调用按姓名查找学生信息的函数;并输出查找结果信息;
char s[20];
printf("input the name you want to find:");
scanf("%s",s);
searchname(s);
printf("\n Press any key Continue.");
getchar();
getchar();
break;
case '4':
//调用根据学号删除某个学生信息的函数;并输出删除后的链表信息;
Node *h;
long n;
printf("input the number you want to delete:");
scanf("%ld",&n);
h=del(n);
if(h==NULL) printf("No find the student \n");
else print();
printf("\n Press any key Continue.");
getchar();
getchar();
break;
case '5':
//调用插入新的学生信息的函数;并输出插入后的链表信息;
long a;
printf("input the number for the new:\n");
scanf("%ld",&a);
inser(a); 2
print();
printf("\n Press any key Continue.");
getchar();
getchar();
break;
case '6':
//调用按分数降序排序输出的函数;并输出排序后的链表信息;
sort(1);
print();
sort(0);
printf("\nPress any key Continue.");
getchar();
getchar();
break;
case '0':
//结束程序运行!
flag=0;
printf("\n *** The End! ***\n");
break;
default: printf("\n Wrong Selection !(选择错误,重选)\n");
getchar();
}
}
}

void menu() //综合作业功能菜单
{
printf(" \n 学 生 信 息 管 理 系 统\n");
printf(" \n 菜 单\n\n");
printf(" \n 1. 建 立 链 表 并 显 示 \n");
printf(" \n 2. 查 找 某 学 号 的 学 生 信 息 \n");
printf(" \n 3. 查 找 某 姓 名 的 学 生 信 息 \n");
printf(" \n 4. 删 除 某 个 学 号 的 学 生\n");
printf(" \n 5. 插 入 新 的 学 生 信 息 \n");
printf(" \n 6. 按 分 数 降 序 排 序 输 出 \n");
printf(" \n 0. 退 出\n\n");
}

void read(void)
{
long a;
printf("input the number:");
scanf("%ld",&a);
while(a>0){ 3
inser(a);
printf("input the number:");
scanf("%ld",&a);
}
}
void inser(long b)
{

Node *last,*current,*p;
current=head;
while(current!=NULL&&b>current->student.num){
last=current;
current=current->next;
}

if(current==NULL||b<current->student.num){
printf("input the name,score:");
p=(Node *)malloc(sizeof(Node));
p->student.num=b;
scanf("%s%f",p->student.name,&p->student.score);
p->next=NULL;
if(current==head){
p->next=head;
head=p;
}
else{
p->next=current;
last->next=p;
}
}
else if(b==current->student.num)
printf("error input a different number:");

}

void print()
{
Node *p=head;
printf("学号 姓名 成绩:\n");
while(p!=NULL){
printf("%ld %s %f\n",p->student.num,p->student.name,p->student.score);
p=p->next;
} 4
printf("\n");
}
void find(long b)
{
Node *p=head;
while(p!=NULL&&b!=p->student.num)
p=p->next;
if(!p) printf("No found\n");
else {
printf("学号 姓名 成绩\n");
printf("%ld %s %f\n",p->student.num,p->student.name,p->student.score);
}

}

void searchname(char *s)
{
Node *p=head;
int flag=0;
printf("学号 姓名 成绩:\n");
while(p!=NULL)
{
if(strcmp(p->student.name,s)==0)
{
printf("%ld %s %f\n",p->student.num,p->student.name,p->student.score);
flag=1;
p=p->next;
continue;
}
else p=p->next;
}
if(!flag) printf("No find");
}
Node * del(long n)
{
Node *p=head,*last;
while(p->student.num!=n){
last=p;
p=p->next;
}
if(p==NULL) return p;
else if(p==head) head=p->next;
else last->next=p->next; 5
return head;
}
void sort(int flag)
{
/*flag==1 按分数排序 else 按学号排序*/
Node *p1,*p2,*k;
float t1;
long t2;
char s[20];
for(p1=head;p1->next;p1=p1->next)
{
k=p1;
for(p2=p1->next;p2;p2=p2->next)
if(flag==1&&k->student.score<p2->student.score||!flag&&k->student.num>p2->student.num)
k=p2;
if(k!=p1){
t1=p1->student.score;
p1->student.score=k->student.score;
k->student.score=t1;
t2=p1->student.num;
p1->student.num=k->student.num;
k->student.num=t2;
strcpy(s,p1->student.name);
strcpy(p1->student.name,k->student.name);
strcpy(k->student.name,s);
}
}
}
给你看看
温馨提示:答案为网友推荐,仅供参考
第1个回答  2007-07-05
#include<iostream.h>
#include<string.h>
#include<fstream.h>
class stu
{
char name[20];
double math,chinese,english,average,sum;
public:
stu()
{
}
stu(char n[20],double ma,double chin,double eng)
{
strcpy(name,n);
math=ma;
chinese=chin;
english=eng;
}
double getsum()
{
sum=chinese+english+math;
return sum;
}
double getaver()
{
average=getsum()/3;
return average;
}
friend void main();
};

void main()
{
cout<<"请选择您需要的操作!"<<endl;
cout<<"操作:"<<endl;
cout<<"(0)数据录入"<<endl;
cout<<"(1)增加人员"<<endl;
cout<<"(2)删除人员"<<endl;
cout<<"(3)修改数据"<<endl;
cout<<"查询:"<<endl;
cout<<"(4)按总成绩查询"<<endl;
cout<<"(5)按姓名查询"<<endl;
cout<<"(6)输出所有学生的数据"<<endl;
cout<<"成绩名词"<<endl;
cout<<"(7)按总分查询排名"<<endl;
cout<<"(8)按语文查询排名"<<endl;
cout<<"(9)按数学查询排名"<<endl;
cout<<"(y)按英语查询排名"<<endl;
cout<<"选择相关操作请输入相对的括号里的阿拉伯数字!"<<endl;
char p;char w;
stu *s[50];
ofstream *file[50];
int i=0;
int j=0;
bool flag2=0;
do
{
cin>>p;
if((p>='0'&&p<='10'))
flag2=1;
else
cout<<"指令错误!请重新输入:"<<endl;
}while(flag2==0);
do{
switch(p)
{
case '0':
{
char c;
char name[20];double math,chinese,english;
do{
cout<<"请输入姓名"<<endl;
cin>>name;
cout<<"请输入数学成绩:"<<endl;
cin>>math;
cout<<"请输入语文成绩:"<<endl;
cin>>chinese;
cout<<"请输入外语成绩:"<<endl;
cin>>english;
file[j]=new ofstream("d:\\document",ios::ate);
*file[j]<<"姓名"<<name<<"数学成绩"<<math<<"语文成绩"<<chinese<<"外语成绩"<<english<<endl;
j++;
s[i]=new stu(name, math, chinese, english);
i++;
cout<<"数据录入成功,想继续录入吗(y/n)"<<endl;
cin>>c;
flag2=0;
do
{
if(c!='y'&&c!='n')
{
cout<<"指令错误!请重新输入!"<<endl;
cin>>c;
}
else
flag2=1;
}while(flag2==0);
}while(c=='y');
break;
}
case '4':
{
double t;char c;
do
{
int flag1=0;
cout<<"请输入你要查询学生的总成绩"<<endl;
cin>>t;
for(int q=0;q<i;q++)
{
if(s[q]->getsum()==t)
{
flag1=1;
cout<<"您要查询的学生是:"<<(*s[q]).name<<endl;
}
}
if(flag1==0)
cout<<"对不起!您要查询的学生不存在!"<<endl;
cout<<"您想继续查询吗?(y/n)"<<endl;
cin>>c;
if(c!='y'&&c!='n')
{
cout<<"指令错误!请重新输入!"<<endl;
cin>>c;
}
}
while(c=='y');
break;
}

case '5':
{
char n[20];int j=0;char c;
do{
int flag=0;
cout<<"请输入你要查询的学生姓名"<<endl;
cin>>n;
for(int j=0;j<i;j++)
{
if(strcmp(n,(*s[j]).name)==0)
{
flag=1;
cout<<"您要查询的学生是:"<<(*s[j]).name<<endl;
cout<<(*s[j]).name<<"的总成绩成绩是"<<(*s[j]).getsum()<<endl<<"平均成绩是:"<<(*s[j]).getaver()<<endl;
}
}
if(flag==0)
cout<<"对不起!您要查询的学生不存在!"<<endl;
cout<<"您想继续查询吗?(y/n)"<<endl;
cin>>c;
if(c!='y'&&c!='n')
{
cout<<"指令错误!请重新输入!"<<endl;
cin>>c;
}
}
while(c=='y');
break;
}
case '1':
{
char name[20];double math,chinese,english;
char c;
do
{
cout<<"请输入您要增加的学生的姓名:"<<endl;
cin>>name;
cout<<"请输入数学成绩:"<<endl;
cin>>math;
cout<<"请输入语文成绩:"<<endl;
cin>>chinese;
cout<<"请输入外语成绩:"<<endl;
cin>>english;
file[j]=new ofstream("d:\\document",ios::ate);
*file[j]<<"姓名"<<name<<"数学成绩"<<math<<"语文成绩"<<chinese<<"外语成绩"<<english<<endl;
j++;
s[i]=new stu(name, math, chinese, english);
i++;
cout<<"数据录入成功,想继续录入吗(y/n)"<<endl;
cin>>c;
if(c!='y'&&c!='n')
{
cout<<"指令错误!请重新输入!"<<endl;
cin>>c;
}
}while(c=='y');
break;
}
case '2':
{
char name[20];bool flag3=0;char c;
do{
cout<<"请输入您要删除的学生姓名:"<<endl;
cin>>name;
for(int h=0;h<i;h++)
{
if(strcmp(name,s[h]->name)==0)
{
flag3=1;
i--;
do{
s[h]=s[h+1];
h++;
}while(h<=i);
}
}
if(flag3==0)
cout<<"您要求删除的对象本来就不存在!请检查输入的正确性!";
cout<<"要继续删除吗?(y/n)"<<endl;
cin>>c;
if(c!='y'&&c!='n')
{
cout<<"指令错误!请重新输入!"<<endl;
cin>>c;
}
}while(c=='y');
break;
}
case '3':
{
char name[20];double mat,chin,eng;flag2=0;
char c;
do
{
cout<<"请输入您要修改的学生的姓名:"<<endl;
cin>>name;
for(int h=0;h<i;h++)
{
if(strcmp(name,s[h]->name)==0)
{
flag2=1;
cout<<"请输入新的数学成绩:"<<endl;
cin>>mat;
cout<<"请输入新的语文成绩:"<<endl;
cin>>chin;
cout<<"请输入新的外语成绩:"<<endl;
cin>>eng;
s[h]->chinese=chin;
s[h]->math=mat;
s[h]->english=eng;
cout<<"数据修改成功!";
}
}
if(flag2==0)
{
cout<<"您要修改的学生本来就不存在!请检查重新输入!"<<endl;
}
cout<<"想继续修改吗(y/n)"<<endl;
cin>>c;
if(c!='y'&&c!='n')
{
cout<<"指令错误!请重新输入!"<<endl;
cin>>c;
}
}while(c=='y');
break;
}

case '6':
{
cout<<"本系统所有学生数据如下:"<<endl;
if(i==0)
cout<<"管理系统中没有录入数据或者数据已经被删除!"<<endl;
for(int k=0;k<i;k++)
{
cout<<k+1<<" "<<"姓名:"<<" "<<s[k]->name<<
"语文:"<<" "<<s[k]->chinese<<"数学:"<<" "<<s[k]->math
<<"外语:"<<" "<<s[k]->english<<"总分:"<<" "<<(*s[k]).getsum()
<<"平均分:"<<" "<<(*s[k]).getaver()<<endl;
}
break;
}
case '7':
{
int t;stu b;

cout<<"本系统所以学生排名如下:"<<endl;
for(int x=0;x<i-1;x++)
{
t=x;
for(int y=x+1;y<i;y++)
{
if((s[t]->getsum())<(s[y]->getsum()))
t=y;
if(t!=x)
{
b=*s[x];
*s[x]=*s[t];
*s[t]=b;
}
}
}
if(i==0)
cout<<"管理系统中没有录入数据或者数据已经被删除!";
for(int k=0;k<i;k++)
{
cout<<k+1<<" "<<"姓名:"<<" "<<s[k]->name<<
"语文:"<<" "<<s[k]->chinese<<"数学:"<<" "<<s[k]->math
<<"外语:"<<" "<<s[k]->english<<"总分:"<<" "<<s[k]->getsum()
<<"平均分:"<<" "<<s[k]->getaver()<<endl;
}
break;
}
case '8':
{
int t;stu b;

cout<<"本系统所以学生语文排名如下:"<<endl;
for(int x=0;x<i-1;x++)
{
t=x;
for(int y=x+1;y<i;y++)
{
if((s[t]->chinese)<(s[y]->chinese))
t=y;
if(t!=x)
{
b=*s[t];
*s[t]=*s[x];
*s[x]=b;
}
}
}

if(i==0)
cout<<"管理系统中没有录入数据或者数据已经被删除!";
for(int k=0;k<i;k++)
{
cout<<k+1<<" "<<"姓名:"<<" "<<s[k]->name<<
"语文:"<<" "<<s[k]->chinese<<"数学:"<<" "<<s[k]->math
<<"外语:"<<" "<<s[k]->english<<"总分:"<<" "<<s[k]->getsum()
<<"平均分:"<<" "<<s[k]->getaver()<<endl;
}
break;
}
case '9':
{
int t;stu b;

cout<<"本系统所以学生数学排名如下:"<<endl;
for(int x=0;x<i-1;x++)
{
t=x;
for(int y=x+1;y<i;y++)
{
if((s[t]->math)<(s[y]->math))
t=y;
if(t!=x)
{
b=*s[t];
*s[t]=*s[x];
*s[x]=b;
}
}
}

if(i==0)
cout<<"管理系统中没有录入数据或者数据已经被删除!";
for(int k=0;k<i;k++)
{
cout<<k+1<<" "<<"姓名:"<<" "<<s[k]->name<<
"语文:"<<" "<<s[k]->chinese<<"数学:"<<" "<<s[k]->math
<<"外语:"<<" "<<s[k]->english<<"总分:"<<" "<<s[k]->getsum()
<<"平均分:"<<" "<<s[k]->getaver()<<endl;
}
break;
}
case 'y':
{
int t;stu b;

cout<<"本系统所以学生英语排名如下:"<<endl;
for(int x=0;x<i-1;x++)
{
t=x;
for(int y=x+1;y<i;y++)
{
if((s[t]->english)<(s[y]->english))
t=y;
if(t!=x)
{
b=*s[t];
*s[t]=*s[x];
*s[x]=b;
}
}
}

if(i==0)
cout<<"管理系统中没有录入数据或者数据已经被删除!";
for(int k=0;k<i;k++)
{
cout<<k+1<<" "<<"姓名:"<<" "<<s[k]->name<<
"语文:"<<" "<<s[k]->chinese<<"数学:"<<" "<<s[k]->math
<<"外语:"<<" "<<s[k]->english<<"总分:"<<" "<<s[k]->getsum()
<<"平均分:"<<" "<<s[k]->getaver()<<endl;
}
}
break;
}

cout<<"您想继续进行其他操作吗?(y/n)"<<endl;
bool flag4=0;
do
{
cin>>w;
if(w!='y'&&w!='n')
cout<<"指令错误!请重新输入!"<<endl;
else
flag4=1;
}while(flag4==0);
if(w=='y')
cout<<"请输入操作代码(0 录入/4 按总分查询/5 按姓名查询/1 增加人员/2 删除人员/3 修改数据/6 显示所有成员数据/7 按总分排名/8 按语文排名/9按数学排名/y按英语排名)"<<endl;
cin>>p;
}while(w=='y');
for(int x=0;x<i;x++)
{
delete s[x];
cout<<"delete all members!"<<endl;
}

}
第2个回答  2023-05-02
用C语言?还是ASP+SQL动态?
问题模糊,不好回答,如果是C语言,你问题发错地方了。
估计这个版面没有人能回答你。
第3个回答  2012-06-19
请问步骤是什么?
第4个回答  2023-04-03
怎么和我们系的要求一样?
相似回答