Basically I just want this code to repeat over if someone enters anything but y,Y, n,N using a Do while loop. But after an answer is entered it infinity loops the corresponding text and never stops. I'm guessing it has to do with
} while ( answer != 'n', 'N', 'y','Y'); but I'm not sure about how to go along fixing it. Any tips would be appreciated.
Your problem is that the user can only enter an answer once. When the answer isn't Y,y,N or n, your program loops and checks the condition again, but the answer hasn't been changed at all resulting in an endless loop.
You have two options:
1. Write your code in a way that lets the user re-enter an answer in case it wasn't yes or no.
2. Add break; in your last else to force-exit the loop, but that ruins the whole purpose a using a do while loop.
Well, once the loop has been entered, there is no way to change the value of answer. Thus if it isn't y or n, the loop will repeat forever. To fix it, move the line cin >> answer; so that it is after the start of the loop
1 2 3
do {
cin >> answer;
// etc.
You may also want to move the question inside the loop too, or change the "you can't read" message so the user will know they are expected to try again with a different answer.