This is my code and it is not working properly so can any one help me in figuring out what is wrong. Thank you.
#include <iostream>
using namespace std;
int Average(long int input1, long int input2);
int Average(long int input1, long int input2, long int input3);
int Average(double input1, double input2);
int main()
{
long int input1, input2, input3;
double newinput1, newinput2;
cout << "Enter 3 integers" << endl;
cin >> input1 >> input2 >> input3;
cout << "The average of " << input1 << " and "<< input2 << " is " << Average(input1, input2)<< endl;
cout << "The average of " << input1 << " , " << input2 << " and " << input3 << " is " << Average(input1, input2, input3) << endl;
cout << "Enter 2 real numbers" << endl;
cin >> newinput1 >> newinput2;
cout << "The average of " << newinput1 << " and " << newinput2 << " is " << Average(newinput1, newinput2) << endl;
return 0;
}
int Average(long int input1, long int input2)
{
long int Avg = (input1 + input2) / 2;
return Avg;
}
int Average(long int input1, long int input2, long int input3)
{
long int Avg2 = (input1 + input2 + input3) / 3;
In my last function in which there are double arguments the out put should be 1.5 if the input is 1 and 2 because that is the average but it is not doing that.. It is just outputting 1 as the out put if I input 1 and 2