jerryIDK6313 commited on
Commit
73b5fe6
·
verified ·
1 Parent(s): 0616b87

Upload test.c

Browse files
Files changed (1) hide show
  1. test.c +26 -0
test.c ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <stdio.h>
2
+
3
+ int main() {
4
+ float x, y;
5
+
6
+ printf("\n");
7
+ // 遍历y轴
8
+ for (y = 1.5f; y > -1.5f; y -= 0.1f) {
9
+ // 遍历x轴
10
+ for (x = -1.5f; x < 1.5f; x += 0.05f) {
11
+ float a = x * x + y * y - 1;
12
+ float b = a * a * a - x * x * y * y * y;
13
+
14
+ // 如果点 (x, y) 在爱心曲线内部或边界上
15
+ if (b <= 0.0f) {
16
+ printf("*");
17
+ } else {
18
+ printf(" ");
19
+ }
20
+ }
21
+ printf("\n");
22
+ }
23
+ printf("\n");
24
+
25
+ return 0;
26
+ }