-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
86 lines (64 loc) · 2.03 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**********************************************/
/**********************************************/
/*********** Author: Mohamed Samir ********/
/*********** DATE: 17-8/2019 ********/
/**********************************************/
/**********************************************/
#include <iostream>
#include <stdlib.h>
#include <fstream>
using namespace std;
int main()
{
int pin;
int choice;
int balance=1000;
int withdraw;
float deposite;
int password;
cout<<"########### WElCOM TO MY ATM ############## \n";
cout<<"Please Enter your PIN : ";
cin>>pin;
ifstream Testfile;
Testfile.open("atm.txt" ,ios::in);
Testfile>> password;
while(pin !=password ){
cout<<"That is not true ,Please Enter your PIN : ";
cin>>pin;
}
do{
cout<<"1. check account \n "<<endl;
cout<<"2. withdraw Cash \n"<<endl;
cout<<"3. Deposit cash \n"<<endl;
cout<<"4. Quite \n"<<endl;
cout<<"############ Chose from the menu : ############ \n\n ";
cin >>choice;
system("cls");
switch (choice){
case 1:
cout<<"##########Your current balance is ########## : $" <<balance<<endl;
break;
case 2 :
cout<<"Enter the amount to withdraw : ";
cin>>withdraw;
if (withdraw > balance ){
cout<<" !!!!!!!!!!!!!You dont have enough money...... !!!!!!!!!!!!!"<<endl;
}else{
balance = balance - withdraw;
cout<<"Your current balance is :$ " <<balance<<endl;
}
break;
case 3:
cout<<"Enter the amount : ";
cin >>deposite;
balance= balance + deposite;
cout<<"Your current balance is : $ " <<balance<<endl;
break;
case 4:
cout<<" *************** Thanke you for using this ************\n\n";
default:
cout<<"the number is not exist..........";
break;
}
}while(choice!=4);
}