Yeah I know, I made it in 10 seconds.
Printable View
Yeah I know, I made it in 10 seconds.
CornedBee: Well, here's a portable toupper() which should work between character sets:
Code:char toupper(char c)
{
static const char *lowercase = "abcdefghijklmnopqrstuvwxyz";
static const char *uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i;
for(i = 0; i < 26; ++i)
{
if(c == lowercase[i])
{
return uppercase[i];
}
}
return c;
}
True. It's also slow.
Don't get me wrong. Considering how stupid the original assignment is, pretty much everything is fine to turn in IMO.
I was just talking about using 97 instead of 'a', 65 instead of 'A', and 32 instead of 'a' - 'A'. To me, the numbers are far less readable, and they have a small portability impact too.