Loop trouble

I have a debug file that i can't seem to well debug. I have tried moving around the loop and adding an if statement but i still can't get it to work right. Any help would be great thanks alot.

// Continues accepting input until
// user enters a vowel
#include<iostream>
using namespace std;

int main()
{
char letter;
cout << "Enter a lowercase vowel >> ";
cin >> letter;
while(letter != 'a' || letter != 'e' || letter != 'i' ||
letter != 'o' || letter != 'u')
{
cout << "Sorry - wrong input. Please enter a lowercase vowel >> ";
cin >> letter;
}
cout << "Thank you. You entered " << 'a' << endl;
return 0;
}
1
2
while(letter != 'a' || letter != 'e' || letter != 'i' ||
letter != 'o' || letter != 'u')

will always be true, try using &&s
Last edited on
Thank you so much. I thougth for sure i had tried that but turns out i didn't thanks again.
Topic archived. No new replies allowed.