⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atmmain.cpp

📁 用C++写的一个模拟ATM自动取款机的程序.我这个程序不同于网上现有的那个不能记录用户填写信息的.
💻 CPP
字号:
/*
=====================================
    atmmain.cpp
=====================================
  */
#include <iostream>
#include "function.h"
#include <stdio.h>
using namespace std;

//====================================
void main()
{	//rstod(char *str, double *dblval) 
 char chose,chose1;
 while(1)
 {
 printhead();//调用显示头部欢迎
 openf();//调用打开文件函数
 
 //test();
 cout<<"\n             请选择操作: ";
 cin>>chose;
 if(chose=='2')//调用注册用户函数
   adduser(1);
 else break;
 }
 int ps=0;
 //addf();
 while(1)
 {
 cout<<endl;
 input();//调用输入用户信息函数
 if(checknp()){
  while(1)
  {	
	  //int __fastcall StrToIntDef(const System::AnsiString ,int Default);
	 print();
	 cout<<" \n   选择一个操作:";cin>>chose1;
	 cout<<"\n";
   switch(chose1)
   {
    case '1':checkmoney();break;
	case'2':{
              char ocp[20],p1[20],p2[20];
			  cout<<"       输入旧密码:";cin>>ocp;
              if(cpw(ocp))
			  {
			  cout<<"       输入新密码:";cin>>p1;
			  cout<<"       确认新密码:";cin>>p2;
              if(strcmp(p1,p2)!=0)
			  {cout<<"       两次输入的密码不一致!\n\n";break;}
			  else
			  {   
                  chpw(ocp,p1);
				  break;
			  }
			  }
			  else
				  { cout<<"        您输入的原密码错误,密码更改不成功!\n\n";break;}
			}
    case '3':{
		double getm;
		cout<<"       输入取钱数目:";
		cin>>getm;
		cout<<endl;
		getmoney(getm,1);
		break;
			 }
     case '4':{
		double inm;
		cout<<"       输入存钱数目:";
		cin>>inm;
		cout<<endl;
		getmoney(inm,2);
		break;
			 }
    case '5':{
		       chn();
		       break;
			 }
    case '6':exit(2);
   }
  }
	 }//如果用户信息正确显示相应操作
 else
 {
   checkpassword(ps);//调用密码错误检查
   ps+=1;//如错误,则记录次数加1
 }
 if(ps==3)break;//密码三次错误就结束本次使用
 }
 

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -