Skip to main content
added 10 characters in body
Source Link
Steadybox
  • 16.5k
  • 5
  • 41
  • 84

C++ (on Windows), 330 312 308 304304 303 bytes

#import<stdio.h>#import<cstdio>
#import<windows.h>
#define P(x,y,s)SetConsoleCursorPosition(GetStdHandle(-11),{X+x,Y+y});puts(s);
int X,Y,R,r,c;t(){P(2,-2,"/\\")P(1,-1,"//\\\\")P(0,0,"///\\\\\\")P(2,1,"||")P(2,2,"||")}f(int n){for(c=R=r=1;c<n;c+=++R);for(;r;r++)for(c=0;++c<r+1;){X=(R-r-2)*4+c*8;Y=r*2;t();r=--n?r:-1;}}

Call with:

int main()
{
    f(8);
}

C++ (on Windows), 330 312 308 304 bytes

#import<stdio.h>
#import<windows.h>
#define P(x,y,s)SetConsoleCursorPosition(GetStdHandle(-11),{X+x,Y+y});puts(s);
int X,Y,R,r,c;t(){P(2,-2,"/\\")P(1,-1,"//\\\\")P(0,0,"///\\\\\\")P(2,1,"||")P(2,2,"||")}f(int n){for(c=R=r=1;c<n;c+=++R);for(;r;r++)for(c=0;++c<r+1;){X=(R-r-2)*4+c*8;Y=r*2;t();r=--n?r:-1;}}

Call with:

int main()
{
    f(8);
}

C++ (on Windows), 330 312 308 304 303 bytes

#import<cstdio>
#import<windows.h>
#define P(x,y,s)SetConsoleCursorPosition(GetStdHandle(-11),{X+x,Y+y});puts(s);
int X,Y,R,r,c;t(){P(2,-2,"/\\")P(1,-1,"//\\\\")P(0,0,"///\\\\\\")P(2,1,"||")P(2,2,"||")}f(int n){for(c=R=r=1;c<n;c+=++R);for(;r;r++)for(c=0;++c<r+1;){X=(R-r-2)*4+c*8;Y=r*2;t();r=--n?r:-1;}}

Call with:

int main()
{
    f(8);
}
added 7 characters in body
Source Link
Steadybox
  • 16.5k
  • 5
  • 41
  • 84

C++ (on Windows), 330 312 308308 304 bytes

#import<stdio.h>
#import<windows.h>
#define P(x,y,s)SetConsoleCursorPosition(GetStdHandle(-11),{X+x,Y+y});printf;puts(s);
int X,Y,R,r,c;t(){P(2,-2,"/\\")P(1,-1,"//\\\\")P(0,0,"///\\\\\\")P(2,1,"||")P(2,2,"||")}f(int n){for(c=R=r=1;c<n;c+=++R);for(;r;r++)for(c=0;++c<r+1;){X=(R-r-2)*4+c*8;Y=r*2;t();if(!;r=--n)r=?r:-1;}}

Call with:

int main()
{
    f(8);
}

C++ (on Windows), 330 312 308 bytes

#import<stdio.h>
#import<windows.h>
#define P(x,y,s)SetConsoleCursorPosition(GetStdHandle(-11),{X+x,Y+y});printf(s);
int X,Y,R,r,c;t(){P(2,-2,"/\\")P(1,-1,"//\\\\")P(0,0,"///\\\\\\")P(2,1,"||")P(2,2,"||")}f(int n){for(c=R=r=1;c<n;c+=++R);for(;r;r++)for(c=0;++c<r+1;){X=(R-r-2)*4+c*8;Y=r*2;t();if(!--n)r=-1;}}

Call with:

int main()
{
    f(8);
}

C++ (on Windows), 330 312 308 304 bytes

#import<stdio.h>
#import<windows.h>
#define P(x,y,s)SetConsoleCursorPosition(GetStdHandle(-11),{X+x,Y+y});puts(s);
int X,Y,R,r,c;t(){P(2,-2,"/\\")P(1,-1,"//\\\\")P(0,0,"///\\\\\\")P(2,1,"||")P(2,2,"||")}f(int n){for(c=R=r=1;c<n;c+=++R);for(;r;r++)for(c=0;++c<r+1;){X=(R-r-2)*4+c*8;Y=r*2;t();r=--n?r:-1;}}

Call with:

int main()
{
    f(8);
}
added 7 characters in body
Source Link
Steadybox
  • 16.5k
  • 5
  • 41
  • 84

C++ (on Windows), 330 312312 308 bytes

#import<stdio.h>
#import<windows.h>
#define P(x,y,s)SetConsoleCursorPosition(GetStdHandle(-11),{X+x,Y+y});printf(s);
int X,Y,R,r,c;t(){P(2,-2,"/\\")P(1,-1,"//\\\\")P(0,0,"///\\\\\\")P(2,1,"||")P(2,2,"||")}f(int n){for(c=R=1;c<n;c+=++Rc=R=r=1;c<n;c+=++R);for(r=1;;r++;r;r++)for(c=0;++c<r+1;){X=(R-r-2)*4+c*8;Y=r*2;t();if(!--n)return 0;r=-1;}}

Call with:

int main()
{
    f(8);
}

C++ (on Windows), 330 312 bytes

#import<stdio.h>
#import<windows.h>
#define P(x,y,s)SetConsoleCursorPosition(GetStdHandle(-11),{X+x,Y+y});printf(s);
int X,Y,R,r,c;t(){P(2,-2,"/\\")P(1,-1,"//\\\\")P(0,0,"///\\\\\\")P(2,1,"||")P(2,2,"||")}f(int n){for(c=R=1;c<n;c+=++R);for(r=1;;r++)for(c=0;++c<r+1;){X=(R-r-2)*4+c*8;Y=r*2;t();if(!--n)return 0;}}

Call with:

int main()
{
    f(8);
}

C++ (on Windows), 330 312 308 bytes

#import<stdio.h>
#import<windows.h>
#define P(x,y,s)SetConsoleCursorPosition(GetStdHandle(-11),{X+x,Y+y});printf(s);
int X,Y,R,r,c;t(){P(2,-2,"/\\")P(1,-1,"//\\\\")P(0,0,"///\\\\\\")P(2,1,"||")P(2,2,"||")}f(int n){for(c=R=r=1;c<n;c+=++R);for(;r;r++)for(c=0;++c<r+1;){X=(R-r-2)*4+c*8;Y=r*2;t();if(!--n)r=-1;}}

Call with:

int main()
{
    f(8);
}
Changed std::cout to printf() and STD_OUTPUT_HANDLE to -11
Source Link
Steadybox
  • 16.5k
  • 5
  • 41
  • 84
Loading
Source Link
Steadybox
  • 16.5k
  • 5
  • 41
  • 84
Loading