common mistake :
while (qAnswer = 'y');
should be
while (qAnswer == 'y');
You understand the difference between '=' and '==' right?
firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608
Your problem is the variable qAnswer. you declare it before the
do while loop and inside it as well.
This code : while(qAnswer == 'y') uses the qAnswer before the
do while loop and not the one inside the loop. Thats because
the qAnswer variable thats inside the loop goes out of scope
before the condition, while(qAnswer == 'y') , is evaluated.
To fix you problem first initialize the qAnswer variable :
like so : char qAnswer = 'y';
Then delete the qAnswer inside the do while loop because thats
not needed. Your loop will use the one before the do while loop.
firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608