Question with Functions

This is a discussion on Question with Functions within the C++ Programming forums, part of the General Programming Boards category; I'm working on a program that needs to calculate the total cost of tuition.
Enter amount of credits -- multiply ...

You are welcome. You said that you wanted the multiplication to be done in one function and the addition in another one. In your implementation you do both in one function. This is ok, but if the requirements are to split these two operations into two functions, then you should do it. It is easy.

When a function does not return something, like in your print one, you write void. So, your print function should be like this

Code:

void rintTotal (double dTotal)
{
cout << "$ " << dTotal << endl;
}

I do not like that you put iCredits as a global variable. Now your program is very small, but as the programs get bigger and bigger and more programmers work on the same projects, global variables, can really be problematic and prone to conflicts (variable shadowing).