Results 1 to 3 of 3

Thread: Multiple Case Identifiers

  1. #1

    Thread Starter
    Junior Member Si_Bateson's Avatar
    Join Date
    Jan 2001
    Location
    East Yorkshire, England
    Posts
    22

    Red face Multiple Case Identifiers

    at the moment ive got this code for a menu

    Code:
    void processchoice(char choice)
    {
    	switch(choice){
    	
    	case 'A': {
    			cout<<"A";
    			break;
    			};
    	case 'M': {
    			cout<<"M";
    			break;
    			}
    	case 'I': {
    			cout<<"I";
    			break;
    			};
    	case 'C': {
    			cout<<"C";
    			break;
    			};
    	case 'E': {
    			cout<<"E";
    			break;
    			};
    	default: {
    			cout<<"Invalid Choice";
    			break;
    			 };
    	};
    }
    but i want to be able to use lower case letters aswell as upper how ...... Help Pls
    Simon Bateson
    [email protected]

  2. #2

    Thread Starter
    Junior Member Si_Bateson's Avatar
    Join Date
    Jan 2001
    Location
    East Yorkshire, England
    Posts
    22
    sorted it out by using toupper in <string.h> so it dont matter no more
    Simon Bateson
    [email protected]

  3. #3
    Zaei
    Guest
    You can do this:
    Code:
    switch(c) {
     case 'A':
     case 'a':
       // do stuff
       break;
    ...
    }
    Z.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width