• 大小: 13KB
    文件类型: .cpp
    金币: 1
    下载: 0 次
    发布日期: 2021-05-27
  • 语言: C/C++
  • 标签: C++  

资源简介

C++版的学生管理系统,使用了指针来实现,界面友好,

资源截图

代码片段和文件信息

#include
#include
#include
#include
#include
using namespace std;
struct User
{
char UserName[20];
char PassWord[20];
};
class Student
{
public:
char name[10];
char specialty[20];
char sex[10];
int age;
char number[20];
int score;
Student *next;
};
class List
{
public:
Student *Head;
int sum;
List()
{
Head=NULL;
sum=0;
}
~List()
{
if(sum>0)
{
Student *sDelete=Head;
Student *sTmp=NULL;
for(int i=0;i{
sTmp=sDelete->next;
delete sDelete;
sDelete=sTmp;
}
sum=0;
sDelete=NULL;
sTmp=NULL;
}


}
Student* MoveTrail(List*li);
void Stu_Start(List*li);
void Stu_Login(List*li);
void Stu_Register(List*li);
void First_Menu(List*li);
void Stu_Out(List*li);
void OutOfNumber(List*li);
void OutOfName(List*li);
void OutAll(List*li);
void Stu_Arrangement(List*li);
void Stu_Polish(List*li);
void Stu_Delete(List*li);
void Stu_First_Add(List*li);
void Stu_Add(Student*stuList*li);
void Stu_Preserve(List*li);


};
void List::Stu_Start(List*li)
{
SYSTEMTIME time;
GetLocalTime(&time);
printf(“                 |===========================================|               \n“);
printf(“                 |              %d-%d-%d %d:%d:%d            |              \n“time.wYeartime.wMonthtime.wDaytime.wHourtime.wMinutetime.wSecond);
printf(“                 |                                           |               \n“);
printf(“                 |                 1. 登陆                   |               \n“);
printf(“                 |                                           |               \n“);
printf(“                 |                 2. 注册                   |               \n“);
printf(“                 |                                           |               \n“);
printf(“                 |                 3. 退出                   |               \n“);
printf(“                 |                                           |               \n“);
printf(“                 |                                           |               \n“);
printf(“                 |===========================================|               \n“);
printf(“请输入功能数字:“);
int a;
cin>>a;
getchar();
if(a==1) li->Stu_Login(li);
if(a==2) li->Stu_Register(li);
if(a==3) exit(0);
}
Student* List::MoveTrail(List*li)
{
Student *sTmp=li->Head;
for(int i=1;isTmp=sTmp->next;
return sTmp;
}
void List::Stu_Login(List*li)
{
ifstream in(“d:\\data.dat“);
if(!in)
{
cout<<“can not open!\n“;
return ;
}
struct User us;
in.read((char*)&ussizeof(User));
char paa[20]naa[20];
cout<<“请输入用户名:“;
cin>>naa;
cout<<“请输入密码:“;
cin>>paa;
if(strcmp(us.UserNamenaa)==0&&strcmp(us.PassWordpaa)==0)
{
cout<<“                                  登陆成功!“<li->First_Menu(li);
   }
else
{
cout<<“                              登陆失败!请重新登陆。。。“<li->Stu_Start(li);
}
in.close();


}
void List::Stu_Register(List*li)
{
ofstrea

评论

共有 条评论