?? test_circle.c
字號:
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <errno.h>
#include <math.h>
#include <stdlib.h>
#include <io.h>
#include <sys/stat.h>
#include <process.h>
#include <string.h>
#include <limits.h>
#include "fitting.h"
#define X_REF 12.241
#define Y_REF 35.21
#define RADIUS 55.0
#define FILE_NAME "my_circle.asc"
int
put_to_file(FILE *fp, double x, double y) {
fprintf(fp, "%lf %lf\n", x, y);
return 0;
}
int
put_end (FILE *fp, char *str) {
fprintf(fp, "%s\n", str);
return 0;
}
int
main() {
int i;
double tmp_x, tmp_y, tmp;
FILE *fp;
if((fp=fopen(FILE_NAME, "w+")) == NULL) {
printf("fail to open the file\n");
exit(0);
}
for(i=0; i<1000; i++) {
//printf("%d\n", i);
tmp_x += 0.05;
tmp = RADIUS*RADIUS-(tmp_x-X_REF)*(tmp_x-X_REF);
if(tmp < 0) {
printf("error parameter\n");
exit(0);
}
tmp_y = sqrt(tmp)+Y_REF;
put_to_file(fp, tmp_x, tmp_y);
}
put_end(fp, "**end cloud**");
fclose(fp);
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -