Simple y/n loop making me loopy?
So I'm making a look that asks if you would like to level up your character. If you say yes it asks you again until you're level 20 (the D&D level cap) or until you say no.

I type y then hit enter, it says it's wrong, hit n then enter, same thing. Here's my code:

	char yn;
	do {
		cin >> yn;
		while (yn != 'y' || yn != 'n') {
			cout << "Only y or n are valid options, try again: ";
			cin >> yn;
		}
		if (yn == 'y')
			f.levelUp();
		cout << endl;
	} while(yn != 'n' || f.getLevel() != 20);

I feel like I'm missing something very obvious!
Simple y/n loop making me loopy?
===

So I'm making a look that asks if you would like to level up your character. If you say yes it asks you again until you're level 20 (the D&D level cap) or until you say no.

I type y then hit enter, it says it's wrong, hit n then enter, same thing. Here's my code:

	char yn;
	do {
		cin >> yn;
		while (yn != 'y' || yn != 'n') {
			cout << "Only y or n are valid options, try again: ";
			cin >> yn;
		}
		if (yn == 'y')
			f.levelUp();
		cout << endl;
	} while(yn != 'n' || f.getLevel() != 20);

I feel like I'm missing something very obvious!