Here is the output I'm getting from my solution to this. Its got me a little baffled why its converting every non cap to a lowercase 'a'.
A Test To Remove All Non-Capitals!
Now Making All Capitals!
A Tααα Tα Rααααα Aαα Nαα-Cααααααα!
haha! gots me scratching my head a bit. OK I'll be back in a few days to see if anyone can give me a clue what I'm doing wrong.
//Program to convert lowercase to upper case.
#include <stdio.h>
void upperCase(char string[80])
{
int j;
for(j=0;string[j]!='\0';j++)
{
if(string[j]>='a' && string[j]<='z')
{
string[j]=-'a'+'A';
}
}
return;
}
int main(void)
{
char testString[80]="A Test To Remove All Non-Capitals!";
printf("%s\n",testString);
printf("Now Making All Capitals!\n");
upperCase(testString);
printf("%s",testString);
getchar();
return 0;
}