08/10/28 11:04:05
>>857
課題1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/* (x,y)-平面の点を座標で表す構造体 */
struct Point{
double x, y;
};
/* 原点からの長さを求める関数 */
double length_vector(struct Point *p){
return sqrt(pow(p->x, 2) + pow(p->y, 2));
}
/* 平面の点を表示する関数 */
void print_v(struct Point *p){
printf("(%f, %f)\n", p->x, p->y);
}