What am I doing wrong;
Nov 24, 2017 at 11:47pm UTC
OK dont' punish me to bad on my code, but I was trying to pass a calculation through a program defined function. Everything initialized properly nothing was displayed what did I do wrong any help would be greatly appreciated thanks in advance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
double calcAvg();
int main()
{
calcAvg;
return 0;
}
double calcAvg(double n1, double n2, double n3)
{
int num1 ;
int num2 ;
int num3 ;
int total;
double avg;
avg = (num1 + num2 + num3) / 3;
cout <<"Enter your first Number: " ;
cin >> num1;
cout <<"Enter your Second Number: " ;
cin >> num2;
cout <<"Enter your third Number: " ;
cin >> num3;
cout <<"The Average is: " << avg << endl;
cout << fixed << setprecision (1);
return avg;
}
Nov 24, 2017 at 11:49pm UTC
You can't calculate the average before you have the numbers.
Topic archived. No new replies allowed.