Language: C++

#define pi 3.141592

double koch(double p1x, double p1y, double p2x, double p2y, int n) {
	double sx, sy, ux, uy, tx, ty, lx, ly;
	
	if (p1x > p2x)
	{
		lx = p1x - p2x;
		tx = p2x + lx/3;
		sx = p2x + 2*lx/3;
		if (p1y > p2y)
		{
			ly = p1y - p2y;
			ty = p2y + ly/3;
			sy = p2y + 2*ly/3;
			ux = (sx - tx)*cos(pi/3) - (sy - ty)*sin(pi/3) + sx;
			uy = (sx - tx)*sin(pi/3) - (sy - ty)*cos(pi/3) + sy;
		}
		else
		{
			ly = p2y - p1y;
			sy = p1y + ly/3;
			ty = p1y + 2*ly/3;
			ux = (sx - tx)*cos(pi/3) - (ty - sy)*sin(pi/3) + sx;
			uy = (sx - tx)*sin(pi/3) - (ty - sy)*cos(pi/3) + sy;
		}
	}
	else
	{
		lx = p2x - p1x;
		sx = p1x + lx/3;
		tx = p1x + 2*lx/3;
		if (p1y > p2y)
		{
			ly = p1y - p2y;
			ty = p2y + ly/3;
			sy = p2y + 2*ly/3;
			ux = (tx - sx)*cos(pi/3) - (sy - ty)*sin(pi/3) + sx;
			uy = (tx - sx)*sin(pi/3) - (sy - ty)*cos(pi/3) + sy;
		}
		else
		{
			ly = p2y - p1y;
			sy = p1y + ly/3;
			ty = p1y + 2*ly/3;
			ux = (tx - sx)*cos(pi/3) - (ty - sy)*sin(pi/3) + sx;
			uy = (tx - sx)*sin(pi/3) - (ty - sy)*cos(pi/3) + sy;
		}
	}
	
	if (n > 0)
	{
		koch(p1x, p1y, sx, sy, n - 1);
		printf("%f %f\n", sx, sy);
		koch(sx, sy, ux, uy, n - 1);
		printf("%f %f\n", ux, uy);
		koch(ux, uy, tx, ty, n - 1);
		printf("%f %f\n", tx, ty);
		koch(tx, ty, p2x, p2y, n - 1);
	}
	
	return 0;
}

int main(void) {
	int n;
	scanf("%d", &n);
	
	printf("%f %f\n", 0.00000000, 0.00000000);
	koch(0.00000000, 0.00000000, 100.00000000, 0.00000000, n);
	printf("%f %f\n", 100.00000000, 0.00000000);
	
	return 0;

Compiler output:
a.cc: In function 'double koch(double, double, double, double, int)':
a.cc:16:40: error: 'cos' was not declared in this scope; did you mean 'const'?
   16 |                         ux = (sx - tx)*cos(pi/3) - (sy - ty)*sin(pi/3) + sx;
      |                                        ^~~
      |                                        const
a.cc:16:62: error: 'sin' was not declared in this scope
   16 |                         ux = (sx - tx)*cos(pi/3) - (sy - ty)*sin(pi/3) + sx;
      |                                                              ^~~
a.cc:24:40: error: 'cos' was not declared in this scope; did you mean 'const'?
   24 |                         ux = (sx - tx)*cos(pi/3) - (ty - sy)*sin(pi/3) + sx;
      |                                        ^~~
      |                                        const
a.cc:24:62: error: 'sin' was not declared in this scope
   24 |                         ux = (sx - tx)*cos(pi/3) - (ty - sy)*sin(pi/3) + sx;
      |                                                              ^~~
a.cc:38:40: error: 'cos' was not declared in this scope; did you mean 'const'?
   38 |                         ux = (tx - sx)*cos(pi/3) - (sy - ty)*sin(pi/3) + sx;
      |                                        ^~~
      |                                        const
a.cc:38:62: error: 'sin' was not declared in this scope
   38 |                         ux = (tx - sx)*cos(pi/3) - (sy - ty)*sin(pi/3) + sx;
      |                                                              ^~~
a.cc:46:40: error: 'cos' was not declared in this scope; did you mean 'const'?
   46 |                         ux = (tx - sx)*cos(pi/3) - (ty - sy)*sin(pi/3) + sx;
      |                                        ^~~
      |                                        const
a.cc:46:62: error: 'sin' was not declared in this scope
   46 |                         ux = (tx - sx)*cos(pi/3) - (ty - sy)*sin(pi/3) + sx;
      |                                                              ^~~
a.cc:54:17: error: 'printf' was not declared in this scope
   54 |                 printf("%f %f\n", sx, sy);
      |                 ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #define pi 3.141592
a.cc: In function 'int main()':
a.cc:67:9: error: 'scanf' was not declared in this scope
   67 |         scanf("%d", &n);
      |         ^~~~~
a.cc:69:9: error: 'printf' was not declared in this scope
   69 |         printf("%f %f\n", 0.00000000, 0.00000000);
      |         ^~~~~~
a.cc:69:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:73:18: error: expected '}' at end of input
   73 |         return 0;
      |                  ^
a.cc:65:16: note: to match this '{'
   65 | int main(void) {
      |                ^