2705: 用重载求距离.

时间限制: 1 Sec  内存限制: 128 MB

提交: 208  解决: 114

题目描述

使用函数重载的方法定义两个重名函数,分别求出整型数的两点间距离和浮点型数的两点间距离.只需提交两个函数即可。

#include <iostream>

#include <cmath>

using namespace std;

double func(int,int,int,int),func(double,double,double,double);

int  main( )

{ cout<<func(2,2,5,5)<<endl;

  cout<<func(2.2,2.2,5.5,5.5)<<endl;

return 0;}

输入

输出

样例输出

4.24264
4.6669

你  离  开  了  ,  我  的  世  界  里  只  剩  下  雨  。  。  。

#include <iostream>
#include <cmath>
using namespace std;
double func(int,int,int,int),func(double,double,double,double);
int main()
{
cout<<func(2,2,5,5)<<endl;
cout<<func(2.2,2.2,5.5,5.5)<<endl;
return 0;
}
double func(int x1,int y1,int x2,int y2)
{
return sqrt(pow((x1-x2),2)+pow((y1-y2),2));
}
double func(double x1,double y1,double x2,double y2)
{
return sqrt(pow((x1-x2),2)+pow((y1-y2),2));
}

最新文章

  1. 玩转github----1
  2. Tigase数据库结构(1)
  3. 避开unity的坑(转摘)
  4. Java多线程实现
  5. 使用NBU进行oracle异机恢复
  6. Java基础之线程——使用Runnable接口(JumbleNames)
  7. Maven学习随记
  8. Android -- 获取汉字的首字母
  9. Portlet 通信过程详解
  10. c语言,strcmp(),字符串比较,看Asic 码,str1&gt;str2,返回值 &gt; 0;两串相等,返回
  11. SQLServe错误整理
  12. Android 通过外键连接两个数据库
  13. Windows - 程序猿应该熟记的CMD常用命令
  14. python使用get在百度搜索并保存第一页搜索结果
  15. javaweb项目环境搭建,jdk,tomcat,myeclipse,sqlserver安装 配置
  16. linux添加超级管理员用户,修改,删除用户
  17. SVN-Failed to run the WC DB work queue associated with
  18. 微服务之Sping Cloud
  19. loadrunner提高篇 - 关联技术的经典使用
  20. HDU 1072 Nightmare (广搜)

热门文章

  1. 安卓app测试之cpu监控
  2. java虚拟机(八)--java性能监控与故障处理工具
  3. nginx+keepalived+tomcat+memcache实现双VIP高可用及Session会话保持
  4. layer实现窗口抖动效果
  5. HDU - 2041 - 超级楼梯(dp)
  6. oop设计模式抽象总结
  7. codeforces round #394 (div. 2) A\B 题解
  8. Wow! Such Sequence! (线段树) hdu4893
  9. [K/3Cloud] KSQL日期常量用法注意
  10. canvas裁剪之后的base64转换为上传文件blob对象