VC++有多个重载函数“sqrt“实例与参数列表匹配

在vc++2010中可能会遇到这样的问题:

 

 那么由于sqrt函数中只能使用double或者float型,而给的参数为int型,这样就会矛盾报错,可以将sqrt里面的数值乘以1.0,转化为float或double型,也可以直接定义参数时,定义为double或float型。

猜你喜欢

转载自blog.csdn.net/DongShanYuXiao/article/details/128332735