Jul 3, 2012 at 7:19pm
Your function, Convert, is taking a char and changing the case. So, why not use existing functions to help you?
How about:
1 2 3 4 5 6
|
char Convert(char Character)
{
if (isupper(Character)
{ return tolower(Character); }
else
{ return toupper(Character); }
|
You will still need to check for bad input.
Last edited on Jul 3, 2012 at 7:19pm
Jul 3, 2012 at 7:20pm
for(Counter; Counter > 0; Counter--)
can change this to
for(; Counter > 0; Counter--)
Can get rid of line 22.
In your function, you can get rid of that variable, and just
1 2
|
return tolower(Character); OR
return toupper(Character);
|
Those functions are in <cctype>
Could also get rid of all those
cin.get()
s
EDIT:
Ninja'd by Moschops! :(
Last edited on Jul 3, 2012 at 7:21pm
Jul 4, 2012 at 6:15am
Thanks! I didn't know there were existing functions for this.