h! hope u can help me with my asignment...
example this is the program
char q;
cout<<"Enter a letter";
a=getch();
switch(q)
{
case 'A':
cout<<"Apple";
break;
}
now this is my question: how to swap big letter A to small letter a...when you run the program if u don't press the capslock you will input a small letter "a"...ryt? so ders a logic eror...
aside from puting
if (q='a')
{q='A';}
before the switch...
and make another case like case 'A':
cout<<"Apple";
break;
case 'a':
cout<<"Apple";
break;
What other syntax can be use?
Hope someone will help me hhehehe...thanks!...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
h! hope u can help me with my asignment...
example this is the program
char q;
cout<<"Enter a letter";
a=getch();
switch(q)
{
case 'A':
cout<<"Apple";
break;
}
now this is my question: how to swap big letter A to small letter a...when you run the program if u don't press the capslock you will input a small letter "a"...ryt? so ders a logic eror...
aside from puting
if (q='a')
{q='A';}
before the switch...
and make another case like case 'A':
cout<<"Apple";
break;
case 'a':
cout<<"Apple";
break;
What other syntax can be use?
Hope someone will help me hhehehe...thanks!...
nice one thank you for the information that u gave...this will help me...
I think you could do switch(tolower(q))and then have case 'a': instead. Or just stack multiple cases.
case 'a': case 'A':
cout << "Apple";