Cpp_Primer_Practice icon indicating copy to clipboard operation
Cpp_Primer_Practice copied to clipboard

练习6.50答案有误

Open coolhuhu opened this issue 2 years ago • 1 comments

对于练习6.50中,f(42) 的最佳匹配为 f(int), 但可行函数应该包含两个吧,f(int)f(double, double=3.14)

如下程序所示

#include <iostream>
using namespace std;

void f(double x, double y=3.14) {
    cout << "double x, double y=3.14" << endl;
}

int main()
{
    f(42);
}

运行结果如图所示: image

coolhuhu avatar Sep 27 '23 02:09 coolhuhu

cout << "double "<< x <<", double y="<< y << endl;

LoseYSelf avatar Feb 13 '24 09:02 LoseYSelf