here some code...
char str[20]="aBcdeG_er23d*d";
int index=0;
while(str[index]!='\0')
{
if ((str[index]>='a') && (str[index]<='z'))
{
str[index]=str[index]-32
}
index++;
}
cout>>str>>endl;
thank you reading my poor help...
2007-03-19 03:30:24
·
answer #1
·
answered by QuizBox 2
·
0⤊
0⤋
I don't know how to write in C, but I can trry to give you some basic ways of convertng to uppercase:
Im not sure what poi means but i think you could compare each letter in the string, using a loop, to an array containing the alphabet and create another identical string with uppercase letters, if that made any sence...
There is a way to compare each of the letters in the string variable in ascii format and i think you can then use a formula to convert that letter to uppercase
for example, in acsii, the decimal equivilant to "a" is "97" and "A" is "65", "b" is "98" and "B" is 66 and so on, so you can maybe make something like this (remember, I cant program is c..): if ((Integer)firstLetter.inASCII()>=97&&(Integer)firstLetter.inASCII()<=122) then (Integer)firstLetter.inASCII()-22=newFirstLetter. I dont know if this made any sence to you, if I new more about C then I could be more specific, maybe you can go somewhre with this
2007-03-19 09:47:51
·
answer #2
·
answered by Brian 3
·
0⤊
0⤋