Skip to content

Instantly share code, notes, and snippets.

@jerstlouis
Created May 11, 2014 04:43
Show Gist options
  • Save jerstlouis/8129e935400bd1a3a6fb to your computer and use it in GitHub Desktop.
Save jerstlouis/8129e935400bd1a3a6fb to your computer and use it in GitHub Desktop.
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