VS2013 C++有多个重载函数“sqrt”实例与参数列表匹配
来源:互联网 发布:列车网络控制系统组成 编辑:程序博客网 时间:2024/05/16 09:26
7744问题
#include<stdio.h>#include<math.h>int main(){ for (int a = 1; a <= 9; a++) for (int b = 0;b<= 9; b++) { int n = a * 1100 + b * 11; int m = floor(sqrt(n) + 0.5); if (m*m == n) printf("%d\n", n); } return 0;}
在vs2013中遇到这种问题
分析在C++中sqrt有三种类型,参数分别为double,float,long double。n定义的参数类型是int型,而sqrt()中应该试用double型或者float型,编译器不知道我们要调用哪一个sqrt类型。因此,修改为sqrt(n*1.0)
#include<stdio.h>#include<math.h>int main(){ for (int a = 1; a <= 9; a++) for (int b = 0;b<= 9; b++) { int n = a * 1100 + b * 11; int m = floor(sqrt(n*1.0) + 0.5); if (m*m == n) printf("%d\n", n); } return 0;}
阅读全文
1 0
- VS2013 C++有多个重载函数“sqrt”实例与参数列表匹配
- VS2010 有多个重载函数"sqrt"实例与参数列表匹配
- 没有与参数列表匹配的 重载函数 AfxMessageBox
- 没有与参数列表匹配的 重载函数 AfxMessageBox
- 没有与参数列表匹配的 重载函数 AfxMessageBox
- 错误:没有与参数列表匹配的 重载函数
- 没有与参数列表匹配的 重载函数 AfxMessageBox
- 【VC++】没有与参数列表匹配的 重载函数 AfxMessageBox
- MFC 错误:没有与参数列表匹配的 重载函数
- 没有与参数列表匹配的 重载函数 AfxMessageBox()
- 没有与参数列表匹配的重载函数 AfxMessageBox()
- 错误:没有与参数列表匹配的 重载函数
- MFC 错误:没有与参数列表匹配的 重载函数
- C++使用template时报“有多个重载函数 与参数列表匹配”错误
- str.Format() Error: 没有与参数列表匹配的重载函数
- 函数重载与匹配
- 重载函数参数的转换和匹配
- 程序报错:有多个重载函数“~~”与~~相匹配!
- HTTP响应码
- Kaldi中特征文件格式的转换
- Java基础----Java内部类基础
- CCF 201703-2 学生排队
- 用TextPaint来绘制文字
- VS2013 C++有多个重载函数“sqrt”实例与参数列表匹配
- 笔记-2017.9.12
- windows下启动多个mysql服务
- yii简单分页
- Java学习第四天
- 【python 读取mysql数据】Python如何读取MySQL数据库表数据
- java.util和java.awt的区别
- Python调用windows下DLL详解
- HDU 3555 Bomb 数位dp