Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Templates

Status
Not open for further replies.

Caden

Programmer
Joined
Dec 9, 2001
Messages
101
Location
CA
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 << &quot;Enter 5 numbers: &quot; << flush;
cin >> a;
cin >> b;
cin >> c;
cin >> d;
cin >> e;
cout <<&quot;The Average is: &quot; << (a+b+c+d+e) / 5 << flush << endl;

return EXIT_SUCCESS;
}

Thanks!
Caden
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top