CodePudding user response:
Title is not clear, and Z Z how to deal with didn't say, here in Zz turn a processing
#include
#include
Int main () {
Char * p, STR []="asdfaGSFGSDFGZFADzsadf";
Printf (" % s \ n ", STR);
P=STR.
While (* p)
{
If (* p=='z' | | * p=='z')
* p='a';
Else if (* p & gt;='A' & amp; & * p & lt; 'Z')
+ (* p * p='a' - 'a') + 1;
The else
* p +=1;
p++;
}
Printf (" % s ", STR);
return 0;
}
CodePudding user response:
According to the topic, will be converted to uppercase lowercase letters at the same time, which in turn is at the same time converts uppercase to lowercase, should understand, so it's sample explain impassability, for reference://the current replacement string of letters in the alphabet after a letter, will be converted to uppercase lowercase letters at the same time,
//as input, the ABCD, output: bcde
# include
Void str_Cap_Low (char * s);
Int main ()
{
Char STR [256].
gets(str);
Str_Cap_Low (STR);
Puts (STR);
return 0;
}
Void str_Cap_Low (char * s)
{
While (* s) {
If ((* s & gt;='a' & amp; & * s & lt; )='z') {
If (* s=='z')
* s='a';
The else
* s +=1;
* s -=32;
} the else
If ((* s & gt;='A' & amp; & * s & lt; )='Z') {
If (* s=='Z')
* s='A';
The else
* s +=1;
* s +=32;
}
s++;
}
}
CodePudding user response:
#includeInt main (int arg c, char * argv [])
{
Char STR [100], * p=STR;
The scanf (" % s ", STR);
While (* p)
{
//((* p=(* p | 0 x20) + 1) & lt;='z') | | (* p='a');//lowercase
//* p=((* p | 0 x20) + 1 - 'a') % 26 + 'a';//lowercase
//* p=(* p & amp; 0 XDF) + 1 - 'A') % 26 + 'A';//capital
((* p=(* p & amp; 0 XDF) + 1) & lt;='Z') | | (* p='A');//capital
P++;
}
Printf (" % s \ n ", STR);
Return 0;
}