旧用户验证.cpp
来自「大一时候学C++的大作业,独立开发的一个模拟银行系统,还存在点缺陷,不过相信对初」· C++ 代码 · 共 53 行
CPP
53 行
#include"head.h"
////////////////////////////////////用户登录验证系统///////////////////////////
void System::oldconsumerchk(char oldnamechk[40] , char oldpassword[5])
{
memberdata logchk;
System log_in;
fstream f("consumer.dat",ios::binary|ios::in);
f.seekg(0,ios::end);
long pos=f.tellg();
if(!f)
{cerr<<"文件不能打开"<<endl;
return;
}
int c;
int d;
f.seekg(0,ios::beg);
do
{ f.read((char *)&logchk,sizeof(memberdata));
c=strcmp(logchk.Name,oldnamechk);
}while(f.tellg()!=pos);
if(c==0)
{
do
{
f.read((char *)&logchk,sizeof(memberdata));
d=strcmp(logchk.password,oldpassword);
}while(f.tellg()!=pos);
if(d==0)
{
cout<<"用户信息核对成功\n"<<endl;
system("cls");
cout<<"欢迎光临"<<endl;
log_in.menu();
}
else if(d!=0)
{
cout<<"用户信息核对失败,请重新输入正确的用户名或密码.谢谢~!111"<<endl;
cout<<endl;
}
}
else if(c!=0)
{
cout<<"用户信息核对失败,请重新输入正确的用户名或密码.谢谢~!222222"<<endl;
cout<<endl;
}
f.close();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?