テロ朝で紹介された、円を描く”プログラム”

惜しい:-)

inspired by 「テロ朝で紹介された、円を描く”プログラム”

ring1.c*1

/* ring1.c */
#include "studio.h"
#include <math.h>
main()
float r, th, dth, x, y;
dth = 0.02*M_PI;
r = 1.0;
for ( th=0.0;th<=2.0*M_PI;th=th+dth) {
  x = r * cos(th);
  y = r * sin(th);
  printf("%f %f\n",x,y);
 return 0;

}

studio.h*2

#include <stdio.h>
#include <tchar.h>
#define main() int _tmain(int argc, _TCHAR* argv[]) {
#define printf(a,b,c) {char buf[100];sprintf(buf,a,b,c);puts(buf);}}
#define _USE_MATH_DEFINES

*1:円なら "circle" じゃないかとも思うのだが、天文/宇宙物理の計算だから?→ http://www.esa.c.u-tokyo.ac.jp/ujis2dir/200606_01.pdf

*2:Visual C++ 2010 にてコンパイル確認済。