fork download
  1. #include<math.h>
  2. #include<stdio.h>
  3. struct {
  4. double x;
  5. double y;
  6. } a={1,1},b={0,0};
  7. int main(void){
  8. double len;
  9. len = sqrt( (b.x - a.x)*(b.x - a.x) + (b.y - a.y)*(b.y - a.y) );
  10. printf("点 a と点 b を結ぶ線分の長さ: %lf¥n", len );
  11. return 0;
  12. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
点 a と点 b を結ぶ線分の長さ: 1.414214¥n