-
Code:
if(yn == 'y') // User enters Y or y only
{
return 1;
break;
}
A return statement exits the function immediately. You don't need a break statement in there to break out of the loop. In fact, that break statement will never be executed -- the return statement makes sure of that.
Also, your continue statement in that same loop is also unnecessary. If you left out the continue statement, execution of your program would continue, exiting the else clause, and then going back to the beginning of the loop again.
Code:
yn = verify[0]; // Should not be necessary
yn = tolower(yn); // Force lower input
That's the same as
Code:
yn = tolower(verify[0]);
although the former may be easier to understand.
Note that all of the comments I've made so far don't affect your code at all. It's perfectly valid as it is. It's just a bit redundant or unnecessary.
One last thing: system("PAUSE") is unportable, insecure, and quite slow. It's best not to use it if you can help it. If you want your program to pause before the console window closes, you can use cin.get() or other standard input functions. http://faq.cprogramming.com/cgi-bin/...&id=1043284385