Created
February 22, 2018 14:40
-
-
Save YiqinZhao/6a6bea117b1327e2ca36ba0fbc5a01c4 to your computer and use it in GitHub Desktop.
Generate a love shape
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
for (float y = 1.5f; y > -1.5f; y -= 0.1f) { | |
for (float x = -1.5f; x < 1.5f; x += 0.07f) { | |
float a = x * x + y * y - 1; | |
putchar(' '); | |
putchar(a * a * a - x * x * y * y * y <= 0.0f ? '*' : ' '); | |
} | |
putchar('\n'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment