Skip to content

Instantly share code, notes, and snippets.

@YiqinZhao
Created February 22, 2018 14:40
Show Gist options
  • Save YiqinZhao/6a6bea117b1327e2ca36ba0fbc5a01c4 to your computer and use it in GitHub Desktop.
Save YiqinZhao/6a6bea117b1327e2ca36ba0fbc5a01c4 to your computer and use it in GitHub Desktop.
Generate a love shape
#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