I need help with a project for my programming class.
This is what he is asking from me.
"Prompt the user to choose what type of input (wavelength or frequency) he/she wants to enter. Use the data type character ‘f’ or ‘F’ to select frequency and ‘w’ or ‘W’ to select wavelength. If the character entered is different from ‘f’, ‘F’, ‘w’ or ‘W’ your program MUST display a message stating for instance “invalid option” and then allow the user to reenter the character WITHOUT THE NEED to rerun the program."
Included is what I have so far. My problem is allowing the user to reenter the character without the need to rerun the program. The code that I have gets me stuck in an infinite loop. Please help. Thank you
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
usingnamespace std;
int main()
{
int x;
do
{
cout << "Please indicate wether you want to input the wavelength or frequency. " << endl;
cout << "Enter W or w for wavelength and F or f for frequency. ";
cin >> x;
}
while ((x != 'W') || (x != 'w') || (x != 'F') || (x != 'f'));
return 0;
}