📄 查看记录.cpp
字号:
#include"head.h"
//////////////////////////////////////////////查看记录////////////////////////////////////////
void operate::browsefile()
{ System op;
memberdata bf;
int choice;
int n;
char name[40];
fstream f("consumer.dat",ios::binary|ios::in|ios::out);
f.seekg(0,ios::end);
long posEnd=f.tellg();
cout<<"请再次输入你的用户名:";
cin>>name;
system("cls");
cout<<"****************************查询****************************\n";
cout<<setw(55);
op.timeshow();
cout<<endl;
//f.seekg(0,ios::beg);
do{
f.read((char *)&bf,sizeof(memberdata));
n=strcmp(bf.Name,name);
}while(f.tellg()!=posEnd);
if(n==0)
{
cout<<"Member's name: "<<bf.Name<<'\n'
<<"存款余额: "<<bf.cash<<'\n'
<<" "<<bf.cash1<<'\n'
<<" "<<bf.cash2<<'\n'
<<"可支取金额:"<<bf.cash-1<<'\n'
<<" "<<bf.cash1-1<<'\n'
<<" "<<bf.cash2-1<<endl;
cout<<"1:建立文本输出记录"<<endl;
cout<<"0:返回"<<endl;
cin>>choice;
switch(choice)
{
case 0:return;break;
case 1:op.CreateTxt();
default:cout<<"ERROR......"<<endl;
}
}
else cout<<"输出错误"<<endl;
f.close();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -