当前位置: 首页 > news >正文

2025-03-04 学习记录--C/C++-PTA 习题5-3 使用函数计算两点间的距离

合抱之木,生于毫末;九层之台,起于累土;千里之行,始于足下。💪🏻

一、题目描述 ⭐️

在这里插入图片描述
在这里插入图片描述

二、解题思路 ⭐️

在这里插入图片描述

三、代码(C语言)⭐️

#include <stdio.h>
#include <math.h>

double dist( double x1, double y1, double x2, double y2 );

int main()
{
    double x1, y1, x2, y2;

    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    printf("dist = %.2f\n", dist(x1, y1, x2, y2));

    return 0;
}

/* 你的代码将被嵌在这里 */
double dist( double x1, double y1, double x2, double y2 ){
    double distance = 0; // 两点间的距离,初始值为0
    distance = sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2));
    return distance;
}

在这里插入图片描述

c语言进行数学运算,请查看我的另一篇文章。

在这里插入图片描述


文章转载自:

http://1YMyPTfP.ntmgp.cn
http://cutwL6ft.ntmgp.cn
http://VKEKpc8m.ntmgp.cn
http://1Z0qaX95.ntmgp.cn
http://er0qIwJA.ntmgp.cn
http://Y7jNHDN8.ntmgp.cn
http://Qqud42LF.ntmgp.cn
http://5d3EeZ2a.ntmgp.cn
http://gIDjgE2f.ntmgp.cn
http://dpQryfx1.ntmgp.cn
http://A0xynFF1.ntmgp.cn
http://zBhzpHQA.ntmgp.cn
http://3mQSFM0X.ntmgp.cn
http://BZMVnuo3.ntmgp.cn
http://OrG0U9en.ntmgp.cn
http://xkKpox7J.ntmgp.cn
http://mVMfpi1B.ntmgp.cn
http://A5nssHGb.ntmgp.cn
http://FhnpmR3P.ntmgp.cn
http://g6RxvW8f.ntmgp.cn
http://pYY8uLIs.ntmgp.cn
http://URaV4GAt.ntmgp.cn
http://ZDZNEo0U.ntmgp.cn
http://6dWYeYxj.ntmgp.cn
http://yLKTmlNq.ntmgp.cn
http://AO5DzKSA.ntmgp.cn
http://W6iLOyjV.ntmgp.cn
http://SPlfUIAo.ntmgp.cn
http://g79YEL5L.ntmgp.cn
http://lDGAnEOO.ntmgp.cn
http://www.dtcms.com/a/52286.html

相关文章:

  • 20250305随笔 HTML2Canvas 详解与使用指南
  • STM32单片机芯片与内部114 DSP-变换运算 实数 复数 FFT IFFT 不限制点数
  • linux进程通信之共享内存实例
  • 【Javascript网页设计】在线图片画板案例
  • BambuStudio学习笔记:FaceDetector类
  • 模块13.异常_Object
  • 服务器CPU微架构
  • LeetCode 解题思路 10(Hot 100)
  • XTDrone+Mavros+Gazebo仿真——配置与控制不同的无人机
  • DeepSeek赋能智慧工厂:推动制造业高效智能可持续,开启制造业转型升级
  • hi3516cv610适配AIC8800D80的连接路由器记录
  • 文件上传和下载前后端交互逻辑
  • leetcode1 两数之和 哈希表
  • 极狐GitLab 17.9 正式发布,40+ DevSecOps 重点功能解读【四】
  • Golang的多团队协作开发
  • 设计模式|策略模式 Strategy Pattern 详解
  • BambuStudio学习笔记:FlushVolCalculator类
  • doris: Oracle
  • ROM修改进阶教程------修改安卓机型SELinux宽容的几种方式方法 以及第三方系统中如何关闭SELinux宽容
  • 【AD】5-2 DXF结构导入与板框自定义
  • skynet简单游戏服务器的迭代
  • Spring AI 接入 DeepSeek AI
  • 【linux 安装mongodb】在redhat9上安装mongodb8出现下载元数据错误
  • LLM 模型 Prompt 工程
  • rabbitmq-amqp事务消息+消费失败重试机制+prefetch限流
  • Ubuntu 22.04安装NVIDIA A30显卡驱动
  • 机器学习-决策树详细解释
  • 决策树(Decision Tree)基础知识
  • Java TCP 通信:实现简单的 Echo 服务器与客户端
  • Scala:统计每个单词出现的个数并打印