首先你需要了解爱心代码在直角坐标系的方程

数学知识:x 属于 -1.5 ~ 1.5 y 属于 -1 ~ 1.5
和 高中所学的线性规划
请看代码
#include <math.h>
#include <stdlib.h>
 #include <Windows.h>
 #include <stdio.h>
 int main()
 {
     float a,x,y;
     system( "color 0c");  改变背景颜色
     for( x = 1.5f ; x > -1.0f ; x-=0.1f)
     {
         for( y = -1.5f ; y < 1.5f ; y+=0.05f)
         {
             a = pow(x,2) + pow(y,2) - 1;
             putchar( pow(a,3) - pow(y,2)*pow(x,3) <= 0.0f ? '*' : ' ');图像里的点均要小于等于0
         }
         Sleep(150); 执行该代码后 等待0.15秒
         printf("\n");
     }
     return 0;
 }












![P9847 [ICPC2021 Nanjing R] Crystalfly 题解 (SPJ)](https://img-blog.csdnimg.cn/img_convert/2a5de02044f5e19b3931d79b0f082d1f.png)





