C++ overloading functions- VERY URGENT

I'm not really sure about how to overload a function or exactly what that means.  I have to write a program where I have to create a function that accepts two arguments of the same type and computes the arithmetic average.  My instructions say to overload the function to work with three arguments.  I know how to go about writing the program, but I'm not sure exactly how to write the whole overloading part.  Thank you.
alligarbageAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
Is this homework?
Just write one function with two arguments and one function with three arguments.
0
_iskywalker_Commented:
Overloading means you use (declare,implement) the same function for diferent types like cout does:
int i;
char c;
cout << i;
cout << c;
will print both types and operate nice, and will not convert the char to int, or vice-versa. Overloading means so only loading a function name over.
So declare the function with 3 arguments and use the function once with 2 and with 3 and you will see, it compiles and do what it should.
0
sunnycoderCommented:
Hi alligarbage,

Simply delcare and define two functions with the same names ... One function would accept two arguments while second would accespt three arguments. Both functions would compute and return average value of the arguments aupplied.

Since this is homework question, we cannot give you code. Give it a shot and if you are still stuck, post back here with code and specific question.

Cheers!
sunnycoder
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

_iskywalker_Commented:
it doesnt work not only for different arguments number, if you use 2 different argument types it work also
0
ManasiDCommented:
The following code snippets include declarations for two different overloaded Avg functions, with the ability to handle 2 and 3 parameters each.
Note: Where T is the data type of the argument and tParam1/2/3 are the arguments.
You can include your actually values and check.
<Code edited by sunnycoder, Page Editor>
0
alligarbageAuthor Commented:
Administrator- I didn't include any code in my post, so I'm not sure what you would have edited.  
0
eperniceCommented:
The Administrator was actually talking to ManasiD
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.