-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
58 lines (45 loc) · 1.09 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
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <ctime>
#include "atm.h"
using namespace daniel;
void greeting();
int main() {
int pin{ 0 };
greeting();
std::cout << "insert card to begin" << std::endl;
std::cout << "reading card..." << std::endl;
std::cout << "Enter PIN: ";
std::cin >> pin;
if (pin >= 1000 && pin <= 9999){
Atm* client1 = new Atm("John Doe", 5000);
client1->run();
}
else {
std::cout << "Invalid PIN" << std::endl;
}
greeting();
std::cout << "insert card to begin" << std::endl;
std::cout << "reading card..." << std::endl;
std::cout << "Enter PIN: ";
std::cin >> pin;
if (pin >= 1000 && pin <= 9999) {
Atm* client2 = new Atm("Jane Doe", 5000);
client2->run();
}
else {
std::cout << "Invalid PIN" << std::endl;
}
return 0;
}
void greeting() {
std::time_t currentTime = std::time(NULL);
std::tm* localTime = std::localtime(¤tTime);
if(localTime->tm_hour < 12) {
std::cout << "Good morning!\n";
} else if(localTime->tm_hour < 18) {
std::cout << "Good afternoon!\n";
} else {
std::cout << "Good evening!\n";
}
}