And as for comparing strings, thankfully, you don't have to (I'm not sure how to do
that myself). You only have to compare characters, which is possible, and easy. First, make sure to declare "char verify" instead of "int verify", and then, when comparing, do like so:
Code:
if ((verify == 'y') || (verify == 'Y'))
{
//conditional code here
}
The reason I have both the lower case and the upper case in there is because if you only have "Y" in the conditional, and the user inputs "y", the program will decide that the conditional was not met. The logical OR operator "||" allows for either occurrence to happen for a success.[/code]
The only problem here is that if you use a single char for input, you'll get a buffer overrun (since it always always write a '\0' at the end of the array). At least you need to do an array 2
two elements. But that's risky too if the user enters more than one char. No, just use
string.
[QUOTEMolokai;684731]You can use the same type of comparison to make a loop around the name verification process, such as do...while. You tell it to do (automatically run once) the name verification, and set the conditional to be "while (!((verify == 'y') || (verify == 'Y') || (verify == 'n') || (verify == 'N'));". This is just what I've found to work, and if there's a shorter way to do that, then tell me, please.