C++ 错误C2664:&x27;打印结果';:无法将参数1从';int(u cdecl*)(int,int,int)和x27;至';int'; #包括 使用名称空间std; 布尔是不同的(整数x,整数y,整数z); int max_of_三(int x,int y,int z); 二的整数(整数x,整数y); 三分之一的最小整数(整数x,整数y,整数z); 两个中较小的整数(整数x,整数y); 无效打印结果(三分之一的最小整数,三分之一的最大整数); int main() { int x,y,z; 而(1==1) { cout x>>y>>z; if(不同于(x,y,z)) {break;} } 打印结果(三个中的最小值,三个中的最大值);//此处出错 } 布尔是不同的(整数x,整数y,整数z) { 如果(x!=y&&x!=z&&y!=z) { 返回true; } 其他的 {返回false;} } 两个中的整数(整数x,整数y) { 如果(x>y) 返回x; 如果(y>x) 返回y; 返回0; } int max_/u三(int x,int y,int z) { 返回两个中的较大值(两个中的较大值(x,y,z); } 两个中较小的整数(整数x,整数y) { if(x

C++ 错误C2664:&x27;打印结果';:无法将参数1从';int(u cdecl*)(int,int,int)和x27;至';int'; #包括 使用名称空间std; 布尔是不同的(整数x,整数y,整数z); int max_of_三(int x,int y,int z); 二的整数(整数x,整数y); 三分之一的最小整数(整数x,整数y,整数z); 两个中较小的整数(整数x,整数y); 无效打印结果(三分之一的最小整数,三分之一的最大整数); int main() { int x,y,z; 而(1==1) { cout x>>y>>z; if(不同于(x,y,z)) {break;} } 打印结果(三个中的最小值,三个中的最大值);//此处出错 } 布尔是不同的(整数x,整数y,整数z) { 如果(x!=y&&x!=z&&y!=z) { 返回true; } 其他的 {返回false;} } 两个中的整数(整数x,整数y) { 如果(x>y) 返回x; 如果(y>x) 返回y; 返回0; } int max_/u三(int x,int y,int z) { 返回两个中的较大值(两个中的较大值(x,y,z); } 两个中较小的整数(整数x,整数y) { if(x,c++,function,parameters,c2664,C++,Function,Parameters,C2664,您正在尝试传递签名的函数指针minu\u of theur和max\u of theur: 整数(*)(整数,整数,整数) 到打印\u结果,该结果需要int参数 你想要这个: #include<iostream> using namespace std; bool is_different(int x, int y, int z); int max_of_three(int x, int y, int z); int greater_of_two(int x, int y); in

您正在尝试传递签名的函数指针
minu\u of theur
max\u of theur

整数(*)(整数,整数,整数)

打印\u结果
,该结果需要
int
参数

你想要这个:

#include<iostream>
using namespace std;

bool is_different(int x, int y, int z);
int max_of_three(int x, int y, int z);
int greater_of_two(int x, int y);
int min_of_three(int x, int y, int z);
int smaller_of_two(int x, int y);
void print_result(int min_of_three, int max_of_three);

int main ()
{
    int x, y, z;
    while(1==1)
    {
        cout << "Please input 3 different integers." << endl;
        cin >> x >> y >> z;
        if (is_different (x, y, z))
        {break;}
    }
    print_result(min_of_three, max_of_three);//error here
}

bool is_different (int x, int y, int z)
{
    if (x!=y && x!=z && y!=z)
    {
        return true;
    }
    else
    {return false;}
}   

int greater_of_two (int x, int y)
{
    if (x > y)
        return x;
    if (y > x)
        return y;
    return 0;
}


int max_of_three (int x, int y, int z)
{
    return greater_of_two(greater_of_two(x, y) , z);
}

int smaller_of_two (int x, int y)
{
    if (x < y)
        return x;
    if (y < x)
        return y;
    return 0;
}

int min_of_three (int x, int y, int z)
{
    return smaller_of_two(smaller_of_two(x, y) , z);
}

void print_result (int min_of_three, int max_of_three)
{
    cout << "The minimum value of the three is " << min_of_three << endl;
    cout << "The maximum value of the three is " << max_of_three << endl;
}
函数
minu\u of_three(x,y,z)
max\u of_three(x,y,z)
返回
int
,然后用作
打印结果
函数的参数

print_result(min_of_three(x,y,z), max_of_three(x,y,z));