请问谁能帮我用Visual FoxPro6.0做一个学生学籍管理系统
要用VisualFoxPro6.0做的,在同一数据库里有三个表:1.学生的基本信息2.学生每个学期的成绩3.学生每个学期的选课情况.这个数据库里面的表要有1.录入2.查询...
要用Visual FoxPro6.0做的,在同一数据库里有三个表:1.学生的基本信息2.学生每个学期的成绩3.学生每个学期的选课情况.这个数据库里面的表要有1.录入2.查询3.修改4.输出,这四个功能.有哪位高人帮解决一下,我急着需要!谢谢!!!
展开
2个回答
展开全部
#include <iostream>
using namespace std;
#include <stdlib.h>
double avg=0;//统计总分和加平均分权
const int mathp=4;//数学学分
const int cppp=5;//C++学分
const sum=70;//设置总学分
class Student
{
private:
int num;
char *name;
char *sex;
char *phone;
char *rphone;
double math;
double cpp;
Student* next;
public:
Student()
{next=NULL;}
~Student();
void Push(Student **refhead,int num,char *name,char *sex,char *phone,char *rphone,double math,double cpp);
void Delete(Student *head,int data);
Student* Find(Student* head,int data);
void Display(Student* head);
int Length(Student* head);
void Math(Student* head,int data);
void Update(Student* head,int data);
void Insert();
};
Student* head=new Student;//带头结点的头指针
void Student::Push(Student **refhead,int num,char *name,char *sex,char *phone,char *rphone,double math,double cpp)
{
Student* newnode=new Student;//新增加结点
newnode->num=num;
newnode->name=name;
newnode->sex=sex;
newnode->phone=phone;
newnode->rphone=rphone;
newnode->math=math;
newnode->cpp=cpp;
newnode->next=*refhead;
*refhead=newnode;//重置表头
}
//遍历
void Student::Display(Student* head)
{
Student* temp;
temp=head;
if(temp->next==NULL)//判断空表
cout<<"没有学生!";
else
{while(temp!=NULL)//
{
cout<<"学号:"<<temp->num<<"姓名:"<<temp->name<<"性别:"<<temp->sex<<"手机:"<<temp->phone<<"宿舍电话:"<<temp->rphone<<"数学成绩:"<<temp->math<<"C++成绩:"<<temp->cpp<<endl;
temp=temp->next;
}
}
return;
}
//人数
int Student::Length(Student* head)
{
Student* cur;
cur=head;
int count=0;
while(cur!=NULL)
{
count++;//通过累加统计人数
cur=cur->next;
}
return count;
}
//查找
Student* Student::Find(Student* head,int data)
{
Student* cur=head;
bool bo=false;
while(cur!=NULL)
{
if(cur->num=data)
{
bo=true;//如果找到则改变bo的值
cout<<"学号:"<<cur->num<<"姓名:"<<cur->name<<"性别:"<<cur->sex<<"手机:"<<cur->phone<<"宿舍电话:"<<cur->rphone<<"数学成绩:"<<cur->math<<"C++成绩:"<<cur->cpp<<endl;
break;
}
cur=cur->next;
}
if(bo==false)//通过判断bo的值判断找到与否
cout<<"没有这个人!"<<endl;
return cur;
}
//删除
void Student::Delete(Student* head,int data)
{
Student *bef,*cur;
bef=cur=head;
while(cur!=NULL)
{
if(cur->num==data)
break;
else
{bef=cur;cur=cur->next;}
}
if(cur==head)//如果是头结点则删除头结点
{
head=cur->next;
delete cur;
}
else
{
bef->next=cur->next;
delete cur;
}
}
//修改
void Student::Update(Student* head,int data)
{
Student* cur=head;
bool bo=false;
while(cur!=NULL)
{
if(cur->num==data)
{
bo=true;
int a,b;
char *c;
double d;
for(;;) //找到后提供各字段的修改
{ cout<<"1修改学号|2修改姓名|3修改性别|4修改手机号|5修改宿舍电话号|6修改数学成绩|7修改C++成绩|8退出\n";
cin>>a;
switch(a)
{
case 1:cout<<"输入新学号:";
cin>>b;
cur->num=a;
break;
case 2:cout<<"输入新姓名:";
cin>>c;
cur->name=c;
break;
case 3:cout<<"输入新性别:";
cin>>c;
cur->sex=c;
break;
case 4:cout<<"输入新手机号:";
cin>>c;
cur->phone=c;
break;
case 5:cout<<"输入新宿舍电话号:";
cin>>c;
cur->rphone=c;
break;
case 6:cout<<"输入新数学成绩:";
cin>>d;
cur->math=d;
break;
case 7:cout<<"输入C++成绩:";
cin>>d;
cur->cpp=d;
break;
case 8:exit(1);
break;
default:cout<<"操作错误";
break;
}
}
break;
}
}
if(bo==false)
cout<<"没有这个人!"<<endl;
return;
}
//统计
void Student::Math(Student* head,int data)
{
Student* cur=head;
bool bo=false;
while(cur!=NULL)
{
if(cur->num=data)
{
bo=true;
avg=cur->math*(mathp/sum)+cur->cpp*(cppp/sum);//计算总分和加平均分权的公式
break;
}
cur=cur->next;
}
if(bo==false){
cout<<"没有这个人!"<<endl;
return;
}
cout<<"该生的总分和加平均分权="<<avg<<endl;
return;
}
//录入
void Student::Insert()
{
head=NULL;
int num;
char name[8];
char sex[4];
char phone[11];
char rphone[7];
double math;
double cpp;
cout<<"请输入基本信息:\n";
cout<<"学号:";
cin>>num;
cout<<"姓名:";
cin>>name;
cout<<"性别:";
cin>>sex;
cout<<"手机号:";
cin>>phone;
cout<<"宿舍电话:";
cin>>rphone;
cout<<"数学成绩:";
cin>>math;
cout<<"C++成绩:";
cin>>cpp;
Push(&head,num,name,sex,phone,rphone,math,cpp);//调用函数Push建立有序链表
}
//用释构函数逐个释放空间
Student::~Student()
{
while(head!=NULL)
{
delete head;
head=head->next;
}
}
//程序主入口
void main()
{
for(;;)
{
head=NULL;
Student s;
int x;
int data;
cout<<"|1录入|2查找|3删除|4修改|5统计|6退出|\n";
cout<<"请作选择:\n";
cin>>x;
switch(x)
{
case 1:
start:
s.Insert();
cout<<"继续吗?[Y/N]";
char ch;
cin>>ch;
if(ch=='y' || ch=='Y')
goto start;
s.Display(head);
int l;
l=s.Length(head);
cout<<"一共有"<<l<<"个学生。"<<endl;
break;
case 2:
cout<<"请输入你要查找的学生的学号:";
cin>>data;
s.Find(head,data);
break;
case 3:
cout<<"请输入你要删除的学生的学号:";
cin>>data;
s.Delete(head,data);
break;
case 4:
cout<<"请输入你要修改的学生的学号:";
cin>>data;
s.Update(head,data);
break;
case 5:
cout<<"请输入你要统计的学生的学号:";
cin>>data;
s.Math(head,data);
break;
case 6:
exit(1);
break;
default:cout<<"操作错误!"<<endl;
break;
}
}
} 我找的 不知道合不合适 在修改一下吧
using namespace std;
#include <stdlib.h>
double avg=0;//统计总分和加平均分权
const int mathp=4;//数学学分
const int cppp=5;//C++学分
const sum=70;//设置总学分
class Student
{
private:
int num;
char *name;
char *sex;
char *phone;
char *rphone;
double math;
double cpp;
Student* next;
public:
Student()
{next=NULL;}
~Student();
void Push(Student **refhead,int num,char *name,char *sex,char *phone,char *rphone,double math,double cpp);
void Delete(Student *head,int data);
Student* Find(Student* head,int data);
void Display(Student* head);
int Length(Student* head);
void Math(Student* head,int data);
void Update(Student* head,int data);
void Insert();
};
Student* head=new Student;//带头结点的头指针
void Student::Push(Student **refhead,int num,char *name,char *sex,char *phone,char *rphone,double math,double cpp)
{
Student* newnode=new Student;//新增加结点
newnode->num=num;
newnode->name=name;
newnode->sex=sex;
newnode->phone=phone;
newnode->rphone=rphone;
newnode->math=math;
newnode->cpp=cpp;
newnode->next=*refhead;
*refhead=newnode;//重置表头
}
//遍历
void Student::Display(Student* head)
{
Student* temp;
temp=head;
if(temp->next==NULL)//判断空表
cout<<"没有学生!";
else
{while(temp!=NULL)//
{
cout<<"学号:"<<temp->num<<"姓名:"<<temp->name<<"性别:"<<temp->sex<<"手机:"<<temp->phone<<"宿舍电话:"<<temp->rphone<<"数学成绩:"<<temp->math<<"C++成绩:"<<temp->cpp<<endl;
temp=temp->next;
}
}
return;
}
//人数
int Student::Length(Student* head)
{
Student* cur;
cur=head;
int count=0;
while(cur!=NULL)
{
count++;//通过累加统计人数
cur=cur->next;
}
return count;
}
//查找
Student* Student::Find(Student* head,int data)
{
Student* cur=head;
bool bo=false;
while(cur!=NULL)
{
if(cur->num=data)
{
bo=true;//如果找到则改变bo的值
cout<<"学号:"<<cur->num<<"姓名:"<<cur->name<<"性别:"<<cur->sex<<"手机:"<<cur->phone<<"宿舍电话:"<<cur->rphone<<"数学成绩:"<<cur->math<<"C++成绩:"<<cur->cpp<<endl;
break;
}
cur=cur->next;
}
if(bo==false)//通过判断bo的值判断找到与否
cout<<"没有这个人!"<<endl;
return cur;
}
//删除
void Student::Delete(Student* head,int data)
{
Student *bef,*cur;
bef=cur=head;
while(cur!=NULL)
{
if(cur->num==data)
break;
else
{bef=cur;cur=cur->next;}
}
if(cur==head)//如果是头结点则删除头结点
{
head=cur->next;
delete cur;
}
else
{
bef->next=cur->next;
delete cur;
}
}
//修改
void Student::Update(Student* head,int data)
{
Student* cur=head;
bool bo=false;
while(cur!=NULL)
{
if(cur->num==data)
{
bo=true;
int a,b;
char *c;
double d;
for(;;) //找到后提供各字段的修改
{ cout<<"1修改学号|2修改姓名|3修改性别|4修改手机号|5修改宿舍电话号|6修改数学成绩|7修改C++成绩|8退出\n";
cin>>a;
switch(a)
{
case 1:cout<<"输入新学号:";
cin>>b;
cur->num=a;
break;
case 2:cout<<"输入新姓名:";
cin>>c;
cur->name=c;
break;
case 3:cout<<"输入新性别:";
cin>>c;
cur->sex=c;
break;
case 4:cout<<"输入新手机号:";
cin>>c;
cur->phone=c;
break;
case 5:cout<<"输入新宿舍电话号:";
cin>>c;
cur->rphone=c;
break;
case 6:cout<<"输入新数学成绩:";
cin>>d;
cur->math=d;
break;
case 7:cout<<"输入C++成绩:";
cin>>d;
cur->cpp=d;
break;
case 8:exit(1);
break;
default:cout<<"操作错误";
break;
}
}
break;
}
}
if(bo==false)
cout<<"没有这个人!"<<endl;
return;
}
//统计
void Student::Math(Student* head,int data)
{
Student* cur=head;
bool bo=false;
while(cur!=NULL)
{
if(cur->num=data)
{
bo=true;
avg=cur->math*(mathp/sum)+cur->cpp*(cppp/sum);//计算总分和加平均分权的公式
break;
}
cur=cur->next;
}
if(bo==false){
cout<<"没有这个人!"<<endl;
return;
}
cout<<"该生的总分和加平均分权="<<avg<<endl;
return;
}
//录入
void Student::Insert()
{
head=NULL;
int num;
char name[8];
char sex[4];
char phone[11];
char rphone[7];
double math;
double cpp;
cout<<"请输入基本信息:\n";
cout<<"学号:";
cin>>num;
cout<<"姓名:";
cin>>name;
cout<<"性别:";
cin>>sex;
cout<<"手机号:";
cin>>phone;
cout<<"宿舍电话:";
cin>>rphone;
cout<<"数学成绩:";
cin>>math;
cout<<"C++成绩:";
cin>>cpp;
Push(&head,num,name,sex,phone,rphone,math,cpp);//调用函数Push建立有序链表
}
//用释构函数逐个释放空间
Student::~Student()
{
while(head!=NULL)
{
delete head;
head=head->next;
}
}
//程序主入口
void main()
{
for(;;)
{
head=NULL;
Student s;
int x;
int data;
cout<<"|1录入|2查找|3删除|4修改|5统计|6退出|\n";
cout<<"请作选择:\n";
cin>>x;
switch(x)
{
case 1:
start:
s.Insert();
cout<<"继续吗?[Y/N]";
char ch;
cin>>ch;
if(ch=='y' || ch=='Y')
goto start;
s.Display(head);
int l;
l=s.Length(head);
cout<<"一共有"<<l<<"个学生。"<<endl;
break;
case 2:
cout<<"请输入你要查找的学生的学号:";
cin>>data;
s.Find(head,data);
break;
case 3:
cout<<"请输入你要删除的学生的学号:";
cin>>data;
s.Delete(head,data);
break;
case 4:
cout<<"请输入你要修改的学生的学号:";
cin>>data;
s.Update(head,data);
break;
case 5:
cout<<"请输入你要统计的学生的学号:";
cin>>data;
s.Math(head,data);
break;
case 6:
exit(1);
break;
default:cout<<"操作错误!"<<endl;
break;
}
}
} 我找的 不知道合不合适 在修改一下吧
深圳市校管家教育科技有限公司_
2024-02-23 广告
2024-02-23 广告
选择培训学校管理系统,需要考虑多方面因素,如系统功能。培训学校管理系统实现了动态的网络化管理,提高了各职能部门的协同办公效能。培训学校管理系统是针对培训学校的管理和教学特点而设计的高效协同工作平台和优秀的综合管理系统。具体费用不是一定的,和...
点击进入详情页
本回答由深圳市校管家教育科技有限公司_提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询