Created
May 11, 2014 04:43
-
-
Save jerstlouis/8129e935400bd1a3a6fb to your computer and use it in GitHub Desktop.
This file contains 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
import "ecere" | |
class TriApp : Application | |
{ | |
ConsoleFile f { }; | |
void Main() | |
{ | |
int w = 50; | |
int h = 20; | |
bool filled = false, inverted = true; | |
int x, y; | |
for(y = 0; y < h; y++) | |
{ | |
int yc = inverted ? h-1-y : y; | |
int l = (int)sqrt((w * w + h * h) * (yc * yc) / (h * h) - (yc * yc)); | |
if(filled || yc == h-1) | |
{ | |
for(x = 0; x <= l; x++) | |
f.Putc('*'); | |
} | |
else | |
{ | |
f.Putc('*'); | |
if(l > 1) | |
{ | |
for(x = 1; x <= l-1; x++) | |
f.Putc(' '); | |
f.Putc('*'); | |
} | |
} | |
f.Putc('\n'); | |
} | |
system("pause"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment