3 Star 1 Fork 0

ChengyuFeng / DataStructureBH

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
student.cpp 1.69 KB
一键复制 编辑 原始数据 按行查看 历史
ChengyuFeng 提交于 2019-05-13 15:22 . ver0.1,just some test
#include "organize.h"
Student s;
void printTitle()
{
system("cls");
cout << "==========Student Client==========\n";
cout << "-------------Options-------------\n";
cout << "1.change password 2.view scores\n";
cout << "3.exit\n---------------------------------\n";
cout << "What do you want to do? Input the serial number:";
}
bool login(Student &s)
{
system("cls");
cout << "==========Student Client==========\n";
cout << "Login with your id:";
string id, pswd;
cin >> id;
s = findStudentById(id, "./data/studentInfo.txt");
while (s.id == "#")
{
cout << "No such id. Please try again!\nLogin with your id:";
cin >> id;
s = findStudentById(id, "./data/studentInfo.txt");
}
cout << id << "'s password:";
cin >> pswd;
if (pswd == s.password)
return true;
else
return false;
}
void viewScore()
{
return;
}
int main()
{
while (!login(s))
{
cout << "Your id or password is wrong. Please try again!\n";
system("pause");
}
cout << "Welcome! " << s.name << '!' << endl;
system("pause");
int cmd;
printTitle();
while (cin >> cmd)
{
switch (cmd)
{
case 1:
s.pswdChange();
break;
case 2:
viewScore();
break;
case 3:
cout << "Byebye!" << s.name << '!' << endl;
system("pause");
return 0;
default:
cout<<"No such option!\n";
system("pause");
break;
}
printTitle();
}
system("pause");
return 0;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/chengyu2526/DataStructureBH.git
git@gitee.com:chengyu2526/DataStructureBH.git
chengyu2526
DataStructureBH
DataStructureBH
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891