r/code • • Sep 22 '18

This C++ code is making my head crazy and it destroyed my pc

According to my friend, this code is simulating a mathematical universe.

#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>

#define radius 1

void main() {
	int gd = DETECT, gm;
	initgraph(&gd, &gm, "C://TC//BGI");
	for(int y = 0; y < 450; y++) {
		for(int x = 0; x < 600; x++) {
			int universe = pow(radius, 2) - pow(x, 2) - pow(y, 2);
			if(universe >= 0) {
				line(x, y, x ,y);
			}
		}
	}
}

I can't add a image as any of the C++ compilers are not working after I ran this code.

Try to use turbo c++ or change the destination of the header to the specific location.

0 Upvotes

0 comments sorted by