-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient2.cpp
More file actions
85 lines (75 loc) · 2.08 KB
/
Copy pathclient2.cpp
File metadata and controls
85 lines (75 loc) · 2.08 KB
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
#include "bank.h"
int main()
{
Client c("Zaki", "2222", "33100-2345678-9", 1002, 120000);
string name, password;
int choice;
cout << "<------ CLIENT 2 LOGIN ------>\n";
cout << "Enter Username: ";
getline(cin, name);
cout << "Enter Password: ";
getline(cin, password);
if (!c.login(name, password))
{
cout << "Invalid Credentials!\n";
return 0;
}
cout << "\nLogin Successful!\n";
do
{
cout << "\n<------ CLIENT 2 MENU ------>\n";
cout << "1. View Account Details\n";
cout << "2. Deposit\n";
cout << "3. Withdraw\n";
cout << "4. Check Balance\n";
cout << "5. Change Name\n";
cout << "6. Exit\n";
cout << "Enter choice: ";
cin >> choice;
if (choice == 1)
{
c.displayInfo();
}
else if (choice == 2)
{
double amount;
cout << "Enter amount to deposit: ";
cin >> amount;
c.deposit(amount);
}
else if (choice == 3)
{
cout << "Re-enter Username: ";
cin.ignore(); // consuming the newline character
getline(cin, name);
cout << "Re-enter Password: ";
getline(cin, password);
if (c.login(name, password))
{
double amount;
cout << "Enter amount to withdraw: ";
cin >> amount;
c.withdraw(amount);
}
else
{
cout << "Authentication Failed!\n";
}
}
else if (choice == 4)
{
c.checkBalance();
}
else if (choice == 5)
{
string newName,providedCnic;
cout << "Please Re-Enter your CNIC: ";
cin.ignore();
getline(cin, providedCnic);
cout << "Enter new name: ";
getline(cin, newName);
c.changeName(newName, providedCnic);
}
} while (choice != 6);
return 0;
}