#include <iostream.h>
#include <fstream.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <windows.h>
struct Acount{
char name[20];
int cardnu;
int code;
double Ban;
char time[26];
};
struct Acount user;
int i;
void Welcome()
{
cout<<"* *"<<endl;
cout<<"* 欢迎使用新利银行ATM机 *"<<endl;
cout<<"*****************************************\n"<<endl;
cout<<"Please select your native lanuage <;请选择用户语言>\n"<<endl;
cout<<" 1. English\n 2. 中文\n 3. Exit <;退出系统>\n"<<endl;
cout<<"Enter you choice <between 1to 3>:";
}
char *_time ()
{
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
return asctime (timeinfo);
}
int find(int card)
{ i=-1;
松潘地震ifstream in("acount.dat",ios::binary|ios::nocreate);
if(!in)
return 0;
while(!in.eof())
{ i++;
if(user.cardnu==card)
{
in.close();
return 1;
}
}
in.close();
return 0;
}
int cardnumber2()
{
int n;
fstream file("账号.dat",ios::binary|ios::nocreate|ios::in|ios::out);
if(!file)
{
cout<<"不能打开此文件"<<endl;
return 0;
}
n=0;
while(!n)
{
}
int m=0;
file.seekp(-4,ios::cur);
file.write((char*)&m,sizeof(int));
file.close();
return n;
}
void print2()
{
system("cls");
char time[25];
strcpy(time,_time());
time[24]=' ';
cout<<" AUTOMATIC TELLER MACHINE - HENER BANKING SYSTEM"<<endl;
cout<<" CARDHOLDER BILL COPY 持卡人存根"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<"| 终端机号 | 10203 |"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<"| 卡别 | 信用卡 |"<<endl;
cout<<"| 卡号 | "<<user.cardnu<<" |"<<endl;
cout<<"| | |"<<endl;
cout<<"| 交易类型 | 银行卡开户 |"<<endl;
cout<<"| 交易批号 | 198447 |"<<endl;
cout<<"| 时间/日期 | "<<time<<" |"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<"| CAEDHOLEDER SINATURE | |"<<endl;
cout<<"| 持卡人签名 | |"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<" I ACKNOWLEDGE SATISFACTORY RECEIPT OF RELATIVE SERVICES"<<endl;
cout<<" 我同意以上条款"<<endl;
}
void print2(int x)
{
system("cls");
char time[25];
strcpy(time,_time());
time[24]=' ';
cout<<" AUTOMATIC TELLER MACHINE - HENER BANKING SYSTEM"<<endl;
cout<<" CARDHOLDER BILL COPY 持卡人存根"<<endl;
cout<<"+
-----------------------------------------------------------------+"<<endl;
cout<<"| 终端机号 | 10203 |"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<"| 卡别 | 信用卡 |"<<endl;
cout<<"| 卡号 | "<<user.cardnu<<" |"<<endl;
cout<<"| | |"<<endl;
if(x>0)
cout<<"| 交易类型 | 现金存款 |"<<endl;
else
{ x=-x;
cout<<"| 交易类型 | 现金取款 |"<<endl;
}
cout<<"| 交易批号 | 198447 |"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<"| 时间/日期 | "<<time<<" |"<<endl;
cout<<"| 交易金额 | "<<x<<" |"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<"| CAEDHOLEDER SINATURE | |"<<endl;
cout<<"| 持卡人签名 | |"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<" I ACKNOWLEDGE SATISFACTORY RECEIPT OF RELATIVE SERVICES"<<endl;
cout<<" 我同意以上条款"<<endl;
cout<<"按任意键返回";
<();
<();
}
void Saving2()
{
char ch;
int Tem;
cout<<"请将现金送到指定入口 :";
cin>>Tem;
user.Ban+=Tem;
fstream out("acount.dat",ios::in|ios::out|ios::binary);
out.seekp(i*sizeof(user),ios::beg);
out.write((char*)&user,sizeof(user));
out.close();
cout<<"\t\t\t你已存入"<<Tem<<endl;
Sleep(3000);
cout<<"需要打印凭条吗?(Y = 是. N = 否):"<<endl;
cin>>ch;
if(ch=='y'||ch=='Y')
print2(Tem);
}
void Drawmoney2()
漆黑的灯下一个人会害怕是什么歌名{
char ch;
int Tem;
cout<<"请输入所取金额 (必须是100的整数倍) :";
cin>>Tem;
while(Tem%100)
{
cout<<"Sorry,请重新输入";
cin>>Tem;
}
user.Ban-=Tem;
以家人之名结局是什么fstream out("acount.dat",ios::in|ios::out|ios::binary);
out.seekp(i*sizeof(user),ios::beg);
out.write((char*)&user,sizeof(user));
out.close();
cout<<"请在30秒内取走现金;"<<Tem<<endl;
Sleep(3000);
cout<<"需要打印凭条吗 ? (y = 是,n = 否):";
cin>>ch;
if(ch=='y'||ch=='Y')
print2(-Tem);
}
void Change2()
{
int tem,j=3;
cout<<"请输入你的原密码";
do{
cin>>tem;
j--;
if(tem==de)
{
cout<<"请输入你的新密码:";
cin>>tem;
fstream out("acount.dat",ios::binary|ios::in|ios::out);
out.seekp(i*sizeof(user),ios::beg);
out.write((char*)&user,sizeof(user));
out.close();
cout<<"密码修改成功,请记下此密码 "<<tem<<endl;
Sleep(2000);
j=0;
cout<<"按任意键返回";
<();
<();
}
else
cout<<"密码错误请重新输入 (你还有"<<j<<"次输入机会)";
}while(j);
}
void Select2()
{
int choice,code;
cout<<"请输入你的密码 ";
do{
cin>>code;
de==code)
break;
else
cout<<"密码错误,请重新输入 ";
}while(2);
do
{
cout<<"请选择业务功能"<<endl;
cout<<" 1. 人民币存款业务\n 2. 人民币取款业务\n 3. 余额查询\n 4. 修改密码\n 5. 返回\n"<<endl;
cout<<"请选择<1 到 5 > :";
do{
cin>>choice;
switch(choice)
{
case 1: Saving2(); break;
case 2: Drawmoney2(); break;
case 3: { cout<<"你卡上的余额为 :"<<user.Ban<<endl ; cout<<"按任意键返回"<<endl;getchar();break;}
case 4: Change2(); break;
case 5:return ;break;
default:cout<<"输入不合法,请重新输入:";
}
}while(choice>5||choice<1);
}while( choice!=5);
}
void TellerMach2()
{
int tem;
char ch;
do{
cout<<"请插入银行卡(0 = 取消):";
cin>>tem;
if(tem==0)
break;
else
{
if(find(tem)==0)
{
cout<<"对不起,本ATM机不接受你的银行卡!(按F键继续,按任意键返回上一层)"<<endl;
cin>>ch;
if(ch!='F'||ch=='f')
break;
}
else Select2();
}
}while(1);
}
void Management2()
{
int choice;
cout<<"请选择你的业务功能\n\n 1. 银行卡开户业务\n 2. 返回\n"<<endl;
cout<<"请选择<1 到 2>:";
do{
cin>>choice;
if(choice==2)
return ;
else if(choice==1)
{
ofstream out("acount.dat",ios::binary|ios::app);驱蚊灯
cout<<"请输入你的姓名:";
cin>>user.name;
user.cardnu=cardnumber2();
cout<<"你的账号是"<<user.cardnu<<endl;
int n;
cout<<"\n请输入你的密码 (必须是6位):";
do{
cin>>n;
if(n<100000)
cout<<"密码位数不够,请重新输入:";
if(n>999999)
cout<<"密码过长,请重新输入:";
}while(n<100000||n>999999);
user.Ban=10.0;
strcpy(user.time,_time());
out.write((char *)& user,sizeof(user));
out.close();
cout<<"是否打印凭条吗?(y = 是,n = 否 ):";杰斯连招
char ch;
cin>>ch;
if(ch=='y'||ch=='Y')
print2();
cout<<"按任意键返回上一层"<<endl;
getchar();
break;
}
else
cout<<"输入错误!请重新输入:";
} while(1) ;
}
int cardnumber1()
{
int n;
fstream file("账号.dat",ios::binary|ios::nocreate|ios::in|ios::out);
if(!file)
{
cout<<"Can't open the file"<<endl;
return 0;
}
n=0;
while(!n)
{
}
int m=0;
file.seekp(-4,ios::cur);
file.write((char*)&m,sizeof(int));
file.close();
return n;
}
void print1()
{
system("c
ls");
char time[25];
strcpy(time,_time());
time[24]=' ';
cout<<" AUTOMATIC TELLER MACHINE - HENER BANKING SYSTEM"<<endl;
cout<<" CARDHOLDER BILL COPY 持卡人存根"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<"| TERMINAL ID | 10203 |"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<"| CARD TYPE | CREDIT CARD OF HENRY BANK |"<<endl;
cout<<"| CARD NUMBER | "<<user.cardnu<<" |"<<endl;
cout<<"| | |"<<endl;
cout<<"| TRENS TYPE | OPEN ACOUNT |"<<endl;
cout<<"| BATCH NO. | 198447 |"<<endl;
cout<<"| | |"<<endl;
cout<<"| DATA/TIME | "<<time<<" |"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<"| CAEDHOLEDER SINATURE | |"<<endl;
cout<<"| 持卡人签名 | |"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<" I ACKNOWLEDGE SATISFACTORY RECEIPT OF RELATIVE SERVICES"<<endl;
cout<<" 我同意以上条款"<<endl;
cout<<"Press any ken to exit";
<();
<();
}
void print1(int x)
{
system("cls");
char time[25];
strcpy(time,_time());
time[24]=' ';
cout<<" AUTOMATIC TELLER MACHINE - HENER BANKING SYSTEM"<<endl;
cout<<" CARDHOLDER BILL COPY 持卡人存根"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<"| TERMINAL ID | 10203 |"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<"| CARD TYPE | CREDIT CARD OF HENRY BANK |"<<endl;
cout<<"| CARD NUMBER | "<<user.cardnu<<" |"<<endl;
cout<<"| | |"<<endl;
if(x>0)
cout<<"| TRANS TYPE | DEPOSIT CASH |"<<endl;
else
{ x=-x;
cout<<"| TRANS TYPE | TAKING CASH |"<<endl;
}
cout<<"| BATCH NO. | 198447 |"<<endl;
cout<<"| | |"<<endl;
cout<<"| TOTAL AMOUNT | "<<x<<" |"<<endl;
cout<<"| DATA/TIME | "<<time<<" |"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<"| CAEDHOLEDER SINATURE | |"<<endl;
cout<<"| 持卡人签名 | |"<<endl;
cout<<"+-----------------------------------------------------------------+"<<endl;
cout<<" I ACKNOWLEDGE SATISFACTORY RECEIPT OF RELATIVE SERVICES"<<endl;
cout<<" 我同意以上条款"<<endl;
cout<<"Press any k
en to exit";
<();
<();
}
void Saving1()
{
char ch;
int Tem;
cout<<" Please deliver cash to appointment entrance :";
cin>>Tem;
user.Ban+=Tem;
fstream out("acount.dat",ios::in|ios::out|ios::binary);
out.seekp(i*sizeof(user),ios::beg);
out.write((char*)&user,sizeof(user));
out.close();
cout<<"\t\t\tYou have deposit "<<Tem<<endl;
Sleep(3000);
cout<<"Do you want to print?(Y/N):"<<endl;
cin>>ch;
if(ch=='y'||ch=='Y')
print1(Tem);
}
void Drawmoney1()
{
char ch;
int Tem;
cout<<" Please input the amount of moneey you want (it must be is the mutipleof 100) :";
cin>>Tem;
while(Tem%100)
{
cout<<"Sorry,Please input again";
cin>>Tem;
}
user.Ban-=Tem;
fstream out("acount.dat",ios::in|ios::out|ios::binary);
out.seekp(i*sizeof(user),ios::beg);
out.write((char*)&user,sizeof(user));
out.close();
cout<<"Please take the cash in 30 seconds;"<<Tem<<endl;
Sleep(3000);
cout<<"Do you want a print ? (y\n):";
cin>>ch;
if(ch=='y'||ch=='Y')
print1(-Tem);
}
void Change1()
{
int tem,j=3;
cout<<"Please injout you original password";
do{
cin>>tem;
j--;
if(tem==de)
{
cout<<"Please input you new password:";
cin>>tem;
fstream out("acount.dat",ios::in|ios::out|ios::binary);
out.seekp(i*sizeof(user),ios::beg);
out.write((char*)&user,sizeof(user));
out.close();
cout<<"Revise the password successfully, make note of this password please "<<tem<<endl;
Sleep(2000);
j=0;
cout<<"press any key to exit";
<();
<();
}
else
cout<<"password error ,input again (You still have "<<j<<" chances)";
}while(j);
}
void Select1()
{
int choice,code;
cout<<"Please input your password ";
do{
cin>>code;
de==code)
break;
else
cout<<"Password error ,input again ";
}while(2);
do
{
cout<<"Choose the business function please"<<endl;
cout<<" 1. Bank deposit of RMB\n 2. Taking RMB \n 3. inquire balance\n 4. Revise the password\n 5. exit\n"<<endl;
cout<<"Please choose bettween <1 to 5 > :";
do{
cin>>choice;
switch(choice)
{
case 1: Saving1(); break;
case 2: Drawmoney1(); break;
case 3: { cout<<"Your balance of acount is :"<<user.Ban<<endl ; cout<<"press any key to exit"<<endl;getchar();break;}
case 4: Change1(); break;
case 5:return ;break;
default:cout<<"input error ,Please input again:";
}
}while(choice>5||choice<1);
}while( choice!=5);
}
void TellerMach1()
{
char ch;
do{
cout<<"Please insert the bank card(0 = cancel):";
cin>>user.cardnu;
if(user.cardnu==0)
break;
else
{
if(find(user.cardnu)==0)
{
cout<<"Sorry ,your card is accepted !(Press F to continue,Press enter to exit)"<<endl;
cin>>ch;
if(ch!='F'||ch=='f')
break;
}
else Select1();
}
}while(1);
}
void Management1()
{
int choice;
二手房网签cout<<"Please choose your business functions\n\n 1.Bank Card Account Business\n 2. Exit\n"<<endl;
cout<<"Please choose between <1 to 2>:";
do{
cin>>choice;
if(choice==2)
return ;
else if(choice==1)
{
ofstream out("acount.dat",ios::binary|ios::app);
cout<<"Please input your name:";
cin>>user.name;
user.cardnu=cardnumber1();
cout<<"Your acount is"<<user.cardnu<<endl;
int n;
cout<<"\nPlease input your password (the length must be 6):";
do{
cin>>n;
if(n<100000)
cout<<"The length of password is too short,please change again:";
if(n>999999)
cout<<"The length of password is too large,please change again:";
}while(n<100000||n>999999);
user.Ban=10.0;
strcpy(user.time,_time());
out.write((char *)& user,sizeof(user));
out.close();
cout<<"Do you want to print?(y/n ):";
char ch;
cin>>ch;
if(ch=='y'||ch=='Y')
print1();
cout<<"Press any key to exit "<<endl;
getchar();
break;
}
else
cout<<"input error , please input again:";
} while(1) ;
}
void Chinese()
{
int choice;
do{
cout<<"\n\n 请选择你的模式 \n"<<endl;
cout<<" 1. ATM柜员机\n 2.银行业务管理\n 3. 帮助\n 4. 返回\n"<<endl;
cout<<"请选择 <1 到 4>:";
do{
cin>>choice;
switch(choice)
{
case 1 : TellerMach2(); break;
case 2 : Management2(); break;
case 3 : { cout<<" 你必须先在 “银行业务管理”里开户才能使用本取款机 ,按任意键返回";();();break;}
case 4 : { return ; break;}
default : cout<<"输入不合法,请重新输入 :";
}
if(choice==3)
cout<<"\n输入你的选择 :";
}while(choice!=1&&choice!=2);
}while(1);
}
void English()
{
int choice;
do{
cout<<"\n\nPlease input patten\n"<<endl;
cout<<" 1. ATM\n 2.Banking Management\n 3.Help\n 4. Exit\n"<<endl;
cout<<"Please choose between <1 to 4>:";
do{
cin>>choice;
switch(choice)
{
case 1 : TellerMach1(); break;
case 2 : Management1(); break;
case 3 : { cout<<" You must open a acount in 《Banking Management》before you use the ATM,Press any key to continue";();();break;}
case 4 : { return ; break;}
default : cout<<"input error,Please inout again";
}
if(choice==3)
cout<<"\n Please your choice :";
}while(choice!=1&&choice!=2);
}while(1);
}
int main()
{
Welcome();
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论