叫 AutoCAD 自動畫一棵球
(高顯忠, sjgau4311@gmail.com, 2012-02-04 15:17)
1樓
#include <cstdlib>
#include <iostream>
#include <stdio.h>
using namespace std;
typedef struct {
int color;
double xc,yc,zc;
double r;
} ball;
int main(int argc, char *argv[])
{
FILE *f1, *f2;
ball bb[10];
bb[0].color= 4;
bb[0].xc= 5;
bb[0].yc= 6;
bb[0].zc= 7;
bb[0].r= 8;
f1= fopen("xxx.scr", "wt");
fprintf(f1, "color\n%d\n",
bb[0].color);
fprintf(f1, "sphere\n");
fprintf(f1, "%.3lf,%.3lf,%.3lf\n",
bb[0].xc, bb[0].yc, bb[0].zc);
fprintf(f1, "%.3lf\n",
bb[0].r);
// fprintf(f1, "\n");
fclose(f1);
system("PAUSE");
return EXIT_SUCCESS;
}