#include <cstdlib>
#include <iostream>

using namespace std;
// ----------------------------------------------

#include <math.h>
#include <time.h>

#define pi (4.0*atan(1.0))

struct Point {
	double x, y, z;
};

struct Line {
	struct Point p1, p2;
};

struct Circle {
	struct Point pc;
	double r;
};

struct Ball {
	struct Point pc;
	double r;
	int color;
};
// ----------------------------------------------

int main(int argc, char *argv[])
{
   FILE *f1;
   f1= fopen("plot-sin.scr", "wt");
   
   struct Ball sp[10];
   double max= -999, v;
   int i;
   
   srand(time(NULL));
   for (i=0;i<10;i++) {
   	sp[i].pc.x= rand()%100;
   	sp[i].pc.y= rand()%100;
   	sp[i].pc.z= rand()%100;
   	
   	sp[i].r= rand()%10 + 1;
   	sp[i].color= rand()%7 + 1;
   	v= (4.0/3)*pi*(pow(sp[i].r, 3.0));
   	
   	// max >= v
   	if (max < v) max= v;
   	
   	fprintf(f1, "color\n%d\n", 
		sp[i].color);
   	
   	fprintf(f1, "sphere\n");
   	fprintf(f1, "%.3lf,%.3lf,%.3lf\n", 
		sp[i].pc.x, sp[i].pc.y, sp[i].pc.z);
		
   	fprintf(f1, "%.3lf\n", 
		sp[i].r);
   }
   
   printf("max= %.3lf\n", max);
   fclose(f1);
   
   printf("\n Done! \n");
   system("PAUSE");
   return EXIT_SUCCESS;
}// end main()

