我正在尝试制作一个带有重载函数“显示”的程序。到目前为止我还好,但我似乎被困住了。我似乎无法弄清楚我在这里的代码做错了什么。
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double small_num, large_num;
double display;//I think the problem is here!!!
cout <<"Please enter two number starting with the smallest, then enter the largest"<<endl;
cin >> small_num;
cin >> large_num;
display(small_num, large_num);
system("pause");
return 0;
}
void display(int num1, int num2)
{
cout << num1 <<" "<< num2 << endl;
return;
}
void display(double num1, int num2)
{
cout << num1 <<" "<< num2 << endl;
}
void display(int num1, double num2)
{
cout << num1 <<" "<< num2 << endl;
}
void display(double num1, double num2)
{
cout << num1 <<" "<< num2 << endl;
}