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 35 36 37 38 39 40 41 42
|
#include <iostream>
using namespace std;
void GetAve (int ave1, int ave2, int ave3)
{
int average;
average = ((ave1, ave2, ave3)/3);
cout << "Average of " << ave1 << ", " << ave2 << ", and " << ave3 << " is " << average << "\n" << endl;
}
void GetAve (double ave1, float ave2, double ave3)
{
float average;
average = ((ave1, ave2, ave3)/3);
cout << "Average of " << ave1 << ", " << ave2 << ", and " << ave3 << " is " << average << "\n" << endl;
}
int main()
{
GetAve(20, 60, 100);
GetAve(2.41, 3.333, 12.25);
int x,y,z;
cout<<"x = "; cin>>x;
cout<<"y = "; cin>>y;
cout<<"z = "; cin>>z;
GetAve(x,y,z);
float a,b,c;
cout<<"a = "; cin>>a;
cout<<"b = "; cin>>b;
cout<<"c = "; cin>>c;
GetAve(a,b,c);
double u,v,w;
cout<<"u = "; cin>>u;
cout<<"v = "; cin>>v;
cout<<"w = "; cin>>w;
GetAve(u,v,w);
return 0;
}
|