-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalentine test.cpp
95 lines (73 loc) · 2.3 KB
/
valentine test.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
86
87
88
89
90
91
92
93
94
95
#include<iostream>
#include<ctime>
#include<conio.h>
#include<windows.h>
using namespace std;
void printHeartPattern() {
cout << " *** ***" << endl;
cout << " ***** *****" << endl;
cout << "**************" << endl;
cout << " ***********" << endl;
cout << " *********" << endl;
cout << " *******" << endl;
cout << " *****" << endl;
cout << " ***" << endl;
cout << " *" << endl;
}
void greetUser() {
time_t now = time(0);
tm* ltm = localtime(&now);
int hour = ltm->tm_hour;
cout << "Welcome!" << endl;
cout << "Current time: ";
if (hour >= 5 && hour < 12)
cout << "Good morning Janudi !" << endl;
else if (hour >= 12 && hour < 18)
cout << "Good afternoon Janudi!" << endl;
else if (hour >= 18 && hour < 22)
cout << "Good evening Janudi !" << endl;
else
cout << "Good night Janudi !" << endl;
}
void displayHeartAnimation() {
cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout << "\t\t\t\t\tH H AAAAA PPPPP PPPPP Y Y" << endl;
cout << "\t\t\t\t\tH H A A P P P P Y Y " << endl;
cout << "\t\t\t\t\tHHHHHHHHH AAAAAAA PPPPP PPPPP Y " << endl;
cout << "\t\t\t\t\tH H A A P P Y " << endl;
cout << "\t\t\t\t\tH H A A P P Y " << endl;
cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
void askToContinue() {
char choice;
do {
cout << "Do you want to continue? (Y/N): ";
choice = _getch(); // get key press
} while (toupper(choice) != 'Y');
}
int main()
{
char choice;
do{
system("cls");
printHeartPattern();
cout<<"Press Z to continue: "<<endl;
while(!_kbhit());
choice=_getch();
}while (toupper(choice)!= 'Z');
greetUser();
do{
cout<<"Do You want to continue? (Y/N): ";
choice=_getch();
}while(toupper(choice) != 'Y' && toupper(choice) != 'N');
if(toupper(choice)=='Y'){
system("cls");
displayHeartAnimation();
cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
cout << "HAPPY BIRTHDAY!!!" << endl;
cout << "Press 'Y' to continue..." << endl;
choice=_getch();
askToContinue();
}
return 0;
}