I'm learning about overloading functions. The program must multiply an integer, double and a combination of integer and double.
What I'm having trouble with is where to put the operations and how to display them in each function. Below is my code and as you can see I have the basics.
#include<iostream>
usingnamespace std;
int main()
{
int a = 10;
double b = 6.5;
system("pause");
return 0;
}
void multiply(int a)
{
cout << "The product of the integer is: " <<
}
void multiply(double b)
{
cout << "The product of the double is: " <<
}
void multiply(int a, double b)
{
cout << "The product of the integer and the double is: " <<
}
// Example program
#include <iostream>
#include <string>
using std::cout;
void multiply(int);
void multiply(double);
void multiply(int, double);
int main()
{
int a = 10;
double b = 6.5;
multiply(a);
multiply(b);
multiply(a, b);
}
void multiply(int a)
{
cout << "The product of the integer is: " << a << '\n';
}
void multiply(double b)
{
cout << "The product of the double is: " << b << '\n';
}
void multiply(int a, double b)
{
cout << "The product of the integer and the double is: " << a * b << '\n';
}
I think it's asking to display the product of the integer and double multiplied by itself. I figured out from your finished example though. Thanks for the help!