-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheart.cpp
49 lines (44 loc) · 1.26 KB
/
heart.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
#include <iostream>
#include <math.h>
using namespace std;
int dist(int x1, int y1, int x2, int y2){
int dx = x2 - x1;
int dy = y2 - y1;
return sqrtf((dx*dx) + (dy*dy));
}
int main(){
int sclx = 71, scly = 71;
int mx = sclx/2 , my = scly/2;
for(int i=0; i<scly; i++){
for(int j=0; j<sclx; j++){
if(i <= scly/2){
if(j <= sclx/2){
if(dist(j,i,round(sclx/4),round(scly/2)) == sclx/4){
cout << "# ";
}
else cout << ". ";
}
else{
if(dist(j,i,round(sclx * 3/4),round(scly/2)) == sclx/4){
cout << "# ";
}
else cout << ". ";
}
}
else{
if(j <= sclx/2){
float m = scly/sclx;
if(j == round((i - scly/2)/m)) cout << "# ";
else cout << ". ";
}
else{
float m = scly/sclx;
if(sclx-j == round((i - scly/2)/m)) cout << "# ";
else cout << ". ";
}
}
}
cout << '\n';
}
return 0;
}