this is my code:
#include%26lt;iostream%26gt;
#include %26lt;iomanip%26gt;
using std::cout;
using std::cin;
using std::endl;
using std::setprecision;
using std::fixed;
//fucntion prototype
void getTestScores(double%26amp;, double%26amp;, double%26amp;);
double calcAverage(double%26amp;, double%26amp;, double%26amp;);
void displayAverage(double);
int main ()
{
//decalare variables
double test1 = 0.0;
double test2 = 0.0;
double test3 = 0.0;
double average = 0.0;
double getAverage = 0.0;
//enter functions to het input items
getTestScores(test1, test2, test3);
getAverage = calcAverage(test1, test2, test3);
displayAverage(average);
return 0;
} //end of main function
//**program defined functions ****
void getTestScores(double %26amp;test1, double %26amp;test2, double %26amp;test3)
{
cout %26lt;%26lt; "Enter the first score: ";
cin %26gt;%26gt; test1;
cout %26lt;%26lt; "Enter the second score: " ;
cin %26gt;%26gt; test2;
cout %26lt;%26lt; "Enter the third score: " ;
cin %26gt;%26gt; test3;
}
Why am i getting a zero in my C++ program? i am just a beginner please help me!!!?
displayAverage(average);
You are sending it the wrong value. your code needs to be
displayAverage(getAverage);
Reply:you can do away with both 'average' and 'getaverage'....
displayAverage(calcAverage(t1,t2,t3));
Reply:instead of
getAverage = calcAverage(test1, test2, test3);
it should be
average = calcAverage(test1, test2, test3);
sound cards
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment