My grammar, spelling, and code may all be wrong!
If this were my problem i would start by writing the program below
-
#include <iostream>
-
using namespace std;
-
-
int main ()
-
{
-
cout<<"a:"<<(int)'a'<<"\n"
-
<<"z:"<<(int)'z'<<"\n"
-
<<"A:"<<(int)'A'<<"\n"
-
<<"Z:"<<(int)'Z'<<"\n"
-
-
while(1){}
-
return 0;
-
}
-
output:
so we could assume
if a character were between 97 and 122 it
is lower case and if it were between
65 and 90 it upper case.
and looking at the numbers above it seems that
the following is true
(97-65 == 32) && (122-90 == 32)
so we can assume subtracting 32 would make a lowercase character a capital one
try out
- cout<<"A:"<< (char)((int)'a'-32);
edit:
i wanted to add a question for you;
is there a reason you are using c style strings? i would find it much easier to work with c++ style strings and maybe even a string stream
another edit:
i was just reading the original post you made. I had another suggestion. and that is to use some character other than '#' as a delimiter. Some people writing P.O. BOX # 120 or APT #2. Seems like pound might occur in the strings you are parsing. why not '|' or maybe '^' you have many choices.