My code below will not return the value from the input in the first function. Sorry i am complete "noob" but the question i am busy with requires the layout below. When the second function runs (float calculateTax(float Rands, float taxRate)) the values of Rand and taxRate are not the numbers i inputted from the first function "float tax( float rands, float taxRate)". Grrr...please assist, code is below many thanks!!
You're not actually sending in Rands1 and tax1, but copies. So once that function is done and it leaves the tax function, the rands and taxrate you send in to calculateTax are still 0, becuase you only changed some copies of it and not the actual thing. So you want to send it in by reference instead
float tax( float& rands, float& taxRate)
1 2 3 4
tax(Rands1, tax1);
calculateTax(Rands1, tax1); // remove this one
taxResults = calculateTax(Rands1, tax1); // keep this one
display(taxResults);
I also dont get why you are calling the calculateTax function twice, doesnt serve any purpose. Remove the first one and keep this one.
Your tax function is of type float, but it doesnt return anything. If you dont want a function to return anything then change it to a void function -
void tax(float& rands, float& taxRate);
Once you do all of these things, you're program will run fine.
My pleasuer, would appricaite if you could edit your post and use the code tags as I mentioned so if someone finds this thread in the future they'll be able to read it properly.