| | |
Distinguish whether the user is inputting a big letter or small
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2009
Posts: 148
Reputation:
Solved Threads: 3
C++ Syntax (Toggle Plain Text)
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:
Swap function:
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 Last edited by MosaicFuneral; Jan 13th, 2009 at 6:55 pm.
"Jedenfalls bin ich überzeugt, daß der Alte nicht würfelt."
"I became very sensitive to what will happen to all this and all of us." -Two geniuses named Albert
"I became very sensitive to what will happen to all this and all of us." -Two geniuses named Albert
•
•
Join Date: Aug 2008
Posts: 206
Reputation:
Solved Threads: 31
•
•
•
•
C++ Syntax (Toggle Plain Text)
switch (choice) { case 'p' || 'P': // do this break; case 's' || 'S': // do that }
won't work
Try this instead;
C++ Syntax (Toggle Plain Text)
switch (choice) { case 'p': case 'P': // do this break; case 's': case 'S': // do that break; }
Right 98% of the time, and don't care about the other 3%.
![]() |
Other Threads in the C++ Forum
- Previous Thread: Weird error... Please help
- Next Thread: Need help writing C++ as OOP (Beginner)
| Thread Tools | Search this Thread |
api array beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game getline google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text text-file tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets





