(链表)学生管理系统
#include<iostream>
#include<string>
using namespace std;
struct Student{
string name; //姓名
string id; //学号
double score; //成绩
struct Student *next;
};
//按照姓名判断学生是否存在
int isExist1(struct Student * head,string name){
struct Student * t=head;
int i=0;
while(t->next){
t=t->next;
if(t->name==name){
return i;
}
i++;
}
return -1;
}
//按照学号判断学生是否存在
int isExist2(struct Student * head,string id){
struct Student * t=head;
int i=0;
while(t->next){
t=t->next;
if(t->id==id){
return i;
}
i++;
}
return -1;
}
void Menu(){
cout<<"************************************"<<endl;
cout<<"************************************"<<endl;
cout<<" 1———添加学生信息"<<endl;
cout<<" 2———删除学生信息"<<endl;
cout<<" 3———查找学生信息"<<endl;
cout<<" 4———修改学生信息"<<endl;
cout<<" 5———显示所有学生信息"<<endl;
cout<<" 6———退出系统"<<endl
#include<string>
using namespace std;
struct Student{
string name; //姓名
string id; //学号
double score; //成绩
struct Student *next;
};
//按照姓名判断学生是否存在
int isExist1(struct Student * head,string name){
struct Student * t=head;
int i=0;
while(t->next){
t=t->next;
if(t->name==name){
return i;
}
i++;
}
return -1;
}
//按照学号判断学生是否存在
int isExist2(struct Student * head,string id){
struct Student * t=head;
int i=0;
while(t->next){
t=t->next;
if(t->id==id){
return i;
}
i++;
}
return -1;
}
void Menu(){
cout<<"************************************"<<endl;
cout<<"************************************"<<endl;
cout<<" 1———添加学生信息"<<endl;
cout<<" 2———删除学生信息"<<endl;
cout<<" 3———查找学生信息"<<endl;
cout<<" 4———修改学生信息"<<endl;
cout<<" 5———显示所有学生信息"<<endl;
cout<<" 6———退出系统"<<endl