>>167 C++ で提出すれば君はヒーローだ。(星形の座標列を生成する) #include <fstream> #include <iomanip> #include <math.h> #include <stdlib.h> using namespace std; #define PI 3.1415926535897932384 void draw_star(ofstream &fout, float x1, int y1) { int i, dot;
dot = abs(y1) + 4; for( i = 0; i <= dot; i++ ) { fout<<setw(6)<< cos(2*PI/dot*i)/2+x1 <<','<<setw(7)<< sin(2*PI/dot*i)/2+y1 <<endl; if( i < dot ) fout<<setw(6)<< cos(2*PI/dot*(i+0.5))/4+x1 <<','<<setw(7)<< sin(2*PI/dot*(i+0.5))/4+y1 <<endl; } fout<<endl; } int main() { float x, xstep; int y; ofstream fout("polygon_29.csv");