I can't seem to figure out what I am doing wrong with passing the parameters between functions. I know that the calculations are correct (they are simple) and in the getTestScores function I went ahead and tested the calculations to make sure. It seems like the values for test1, 2 and 3 aren't being stored in memory as whatever I input gives a value of 0. getTestScores and displayAverage both need to be void functions and that's what I'm struggling with I think.
-------------------------Here's the code-------------------------
Code:
#include <iostream>
#include <iomanip>
using std::cout;
using std::cin;
using std::endl;
using std::fixed;
using std::setprecision;
//function prototypes
void getTestScores (double, double, double);
double calcAverage (double, double, double, double);
void displayAverage (double); //void function, no return value to main.
int main()
{
//declare variables & initialize
double average = 0.0;
double test1 = 0.0;
double test2 = 0.0;
double test3 = 0.0;
//call function to get test scores
getTestScores (test1, test2, test3);
//call function to calculate average
calcAverage (average, test1, test2, test3);
//call function to display average
displayAverage (average);
system ("pause");
return 0;
} //End of the main function
//*************************Function Definitions**********************
//Get Test Scores function
void getTestScores (double test1, double test2, double test3)
{
cout << "Enter the first test score: ";
cin >> test1;
cout << "Enter the second test score: ";
cin >> test2;
cout << "Enter the third test score: ";
cin >> test3;
} //end of getTestScores function
//Calculate Average function (return average value)
double calcAverage (double average, double test1, double test2, double test3)
{
average = (test1 + test2 + test3) / 3;
return average;
} //end of calcAverage function
//Display Average function (double)
void displayAverage (double average)
{
cout << "The average of the three scores you entered is: " << average << endl;
} //end of displayAverage function
Any help would be greatly appreciated by this noob!