It's equal to "letter XOR 32" to change the lower case to upper case and
vice versa. (Invert case without checking)

On Thu, May 17, 2012 at 2:04 AM, Luke Pebody <[email protected]> wrote:

> Replace str(i)&-32 with str(i)|32. Note this is unlikely to work with
> Unicode.
>
>
>
> On 17 May 2012, at 04:15, Registered user <[email protected]>
> wrote:
>
> > this is the code for changing lower case to upper case.
> > can u write something similar to dis for changing upper to lower case
> > ,( i mean using BITWISE operators such type of operators ^ , | , & , ~
> > , !  )
> >
> > #include <iostream>
> > #include <cctype>
> > using namespace std;
> > int main() {
> > string str;
> > cin>>str;
> > unsigned int i, n = str.size();
> > for(i = 0;i < n;++i)
> > str[i] = isalpha(str[i]) ? (str[i] &(~32)) : str[i];
> > cout<<str<<endl;
> >
> > }
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Google Code Jam" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> [email protected].
> > For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>
>


-- 
Att.
Leonardo da Silva Campos

"Keep distance, coder coding!"

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to