-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLiveHeart.cpp
79 lines (71 loc) · 1.76 KB
/
LiveHeart.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
/*
An 2d gif like animated heart for those who like valentain!
This code for valentain day!
Creator : mortzaCFT
*/
#include <iostream>
#include <chrono>
#include <thread>
#include <windows.h>
void print_heart(int rotated_degrees)
{
std::string heart[] =
{
"0001000000100000",
"0011100001110000",
"0111111011111000",
"0111111111111000",
"1111111111111100",
"1111111111111100",
"0111111111111000",
"0111111111111000",
"0011111111110000",
"0001111111100000",
"0000111111000000",
"0000011110000000",
"0000001100000000"
};
std::string rotated_heart[sizeof(heart) / sizeof(heart[0])];
std::string rotated_row = "";
for (int i = 0; i < sizeof(heart) / sizeof(heart[0]); i++)
{
for (int j = 0; j < heart[i].length(); j++)
{
int rotated_col = (j + rotated_degrees) % heart[i].length();
rotated_row += heart[i][rotated_col];
}
rotated_heart[i] = rotated_row;
}
for (int i = 0; i < sizeof(rotated_heart) / sizeof(rotated_heart[0]); i++)
{
for (int j = 0; j < rotated_heart[i].length(); j++)
{
if (rotated_heart[i][j] == '1')
{
std::cout << "*";
}
else
{
std::cout << " ";
}
}
std::cout << std::endl;
}
}
void rotate_heart()
{
int degrees = 0;
while (true)
{
print_heart(degrees);
std::cout << "Valentain mobarak!" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(60));
std::cout << system("cls");
degrees += 1;
}
}
int main()
{
rotate_heart();
return 0;
}