Click here to Skip to main content
15,905,971 members
Please Sign up or sign in to vote.
1.44/5 (3 votes)
See more:
hi guys!

I really don't konw this!

a c program!

Password question: turn the letter A into letter E, a to e, namely into the fourth letter of the following, turn the W into A, X into B, Y into C, Z into D. For example: the transfer "China" to "Glmre".

Procedure is as follows:
XML
#include<stdio.h>
void main()
{
   char c;
   while((c=getchar())!='\n')
           {
              if((c>='a'&&c<='z')||(c>='A'&&c<='Z'))
                  {
                      c=c+4;
                       if(c>'Z'&&c<='Z'+4||c>'z')
                            c=c-26;
                   }
               printf("%c",c);
            }
     printf("\n");
}

my question is:In the first ten lines of code, why the processing of lowercase letters without written c > 'z' && c < = 'z' + 4, but just write c > 'z'?

hope you can help me!thank you
Posted
Comments
santosha epili 23-Oct-13 1:33am    
You can try it with ASCII values of charachters
Captain Price 23-Oct-13 2:00am    
What happens if there are numbers or symbols ?

1 solution

Please don't post your homework in this forum. It is your homework and not anybody else's. Why don't you just try yourself to solve that question. It is really not that hard.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900