Also, prefer to use
double rather than float - if your assignment allows it. The precision of float is easily exceeded - it can only do 6 or 7 significant figures.
In this:
float amount = 72.56;
the 72.56 is actually a double (the default), so when it is assigned to
float amount , there is an implicit cast to convert it to float. One can avoid that by doing
float amount = 72.56f; , but it is better to just make the whole thing double in the first place.
Pass string by reference, probably
const if it is not to be changed:
1 2 3 4
|
void getBalance (const std::string& customerP,
double& Balance,
const char typeC,
const double amtC);
|
Notice I put the reference right next to the type, in C++ there are many who like to emphasise the type, as C++ is all about types. Also the way I have formatted the code when there are multiple parameters.
What does
amtC have to do with getting a balance? What does
amtC even mean?
I am not a fan of abbreviating variable names, unless there is a good reason. With
balAmnt, the amount part is superfluous ; so what's wrong with just
Balance ?
Good Luck !!