File size: 595 Bytes
73b5fe6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#include <stdio.h>

int main() {
    float x, y;

    printf("\n");
    // 遍历y轴
    for (y = 1.5f; y > -1.5f; y -= 0.1f) {
        // 遍历x轴
        for (x = -1.5f; x < 1.5f; x += 0.05f) {
            float a = x * x + y * y - 1;
            float b = a * a * a - x * x * y * y * y;
            
            // 如果点 (x, y) 在爱心曲线内部或边界上
            if (b <= 0.0f) {
                printf("*");
            } else {
                printf(" ");
            }
        }
        printf("\n");
    }
    printf("\n");
    
    return 0;
}