#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
using namespace std;
double meanOf3(double value1, double value2, double value3)
{
double mean;
mean = (value1 + value2 + value3)/3;
return (mean);
}
int main()
{
float value1, value2, value3;
double mean;
mean=0;
cout <<"Enter the first integer whose square root will be included in the mean: ";
cin >>value1;
cout <<"Enter the second integer whose square root will be included in the mean: ";
cin >>value2;
cout <<"Enter the third integer whose square root will be included in the mean: ";
cin >>value3;
value1 = sqrt(value1);
value2 = sqrt(value2);
value3 = sqrt(value3);
meanOf3(value1, value2, value3);
cout <<mean;
}
What I want to do is have 2 functions. One called meanOf3 which will calculate the mean of 3 numbers. The main function will prompt the user for 3 numbers and square root 3 numbers. After that, i would call the meanOf3 to figure out the mean of the squarerooted numbers.
However from what I wrote, I am getting totally wrong results. Can any1 help me out?