Hello everyone, kind of confused with temples, i'm trying to make a temple that will basically take either integers or alpha characters and take an average, so, the temple i'm trying to make is like this
Average ( a, b, c ) and return the average...
so i've found something along the lines of
template <class T = int, int, int/3> but i'm kind of confused...any help you can render would be appreciated,
The function is easy enough to do, just like this...but I don't know how to turn it into a template...
thanks!
int main(int a, int b, int c, int d, int e) {
cout << "Enter 5 numbers: " << flush;
cin >> a;
cin >> b;
cin >> c;
cin >> d;
cin >> e;
cout <<"The Average is: " << (a+b+c+d+e) / 5 << flush << endl;
return EXIT_SUCCESS;
}
Thanks!
Caden
Average ( a, b, c ) and return the average...
so i've found something along the lines of
template <class T = int, int, int/3> but i'm kind of confused...any help you can render would be appreciated,
The function is easy enough to do, just like this...but I don't know how to turn it into a template...
thanks!
int main(int a, int b, int c, int d, int e) {
cout << "Enter 5 numbers: " << flush;
cin >> a;
cin >> b;
cin >> c;
cin >> d;
cin >> e;
cout <<"The Average is: " << (a+b+c+d+e) / 5 << flush << endl;
return EXIT_SUCCESS;
}
Thanks!
Caden