Your Question was:
I need help debugging my C++ code. It's fairly simple, it's about do-while loops.
Here is the link where you can find my code I have done so far:
The syntax is correct, but I think that logic has some sort of an error. Can you please help me make this program more efficient? Once I tried to exit the program, it just continuously runs an infinite loop. Also some of the addition does not display properly.
Please help with this program and provided comments inside the code to see what I did wrong so I can learn from it.
Your code seems to be working properly OK. The only problem is on this line :
while ((again == 'Y') || (again != 'y'));
this statement is wrong because you are checking that again is equal to caps Y or not equal to smallcaps y. I am guessing it is a typing error.
so, instead of that, simply ensure uniformity in the condition. You want to check that as long as again is either caps Y or small caps y, the programme should continue. The statement below should give your code the right doze of injection :)
while ((again == 'Y') || (again == 'y'));