So basically, I'm creating a switch statement that if the user enters a p or if they enter a P it will still work, any ideas? Thank you

switch (choice) 
{
 case 'p' || 'P': // do this
 break;
case 's' || 'S': // do that
}

won't work

Convert the string to evaluate to lower case, then use it.
I prefer if-else statments, of stings for input.

For ASCII
In a loop of string size:

if (is upper case(91< && 64>)) then
    swap_case()

Swap function:

function swap_case(&character)
    character XOR 32

Or for a more reliable solution (ei for more than just ASCII) you can use tolower() and toupper() functions found in the cctype header

Chris

switch (choice) 
{
 case 'p' || 'P': // do this
 break;
case 's' || 'S': // do that
}

won't work

Indeed. 'p' || 'P' would expand to a bool value of true, as will 's' || 'S'. Compilers will generally refuse to compile the above, as particular cases of a switch statement are not allowed to be duplicated.

Try this instead;

switch (choice) 
{
 case 'p':
 case 'P': // do this
 break;
case 's':
case 'S': // do that
  break;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.