capital letters in program

this is what i have

if (command == 'x' || 'X')
//statement
else if(command == 'y' || 'Y')
//statement


if the user inputs a x or y lower or capitol
it always does the first if statement

if i delete the || 'X' and || 'Y'

the program runs fine but if the user inputs a capitol letter then the statements are skiped

so what can i use to fix this

Last edited on
if(command == 'x' || command == 'X')

and

else if(command == 'y' || command == 'Y')

Try those
thank you so much
that did the job
Good. Remember that c++ never really assumes what you're asking it. You have to ask speecific questions every time.
one more
i have a
while(command != 's')
if the user inputs 's' it drops out of the loop

but
when i added the
while(command != 's' || command != 'S')

it goes inside the loop anyway

this is how i have it

std::cout << "x,y, s to stop " << std::flush;
std::cin >> command;

while (command != 's' command != 'S')
{
//statements

}
You;re missing the || between them.
oh thanks
sometimes those things slip and it takes me a while to find them
Topic archived. No new replies allowed.