C言語第七回作業

786 ワード

/*-----------------------------------------------
    :        
    :     51131523
    :                15 
    :2014.11.26
    :    80   ,               ,
  		a->b,b->c,z->a 
------------------------------------------------*/

#include 
void inv (char *s)
{
	int i = 0;
	while (s[i] != '\0')
	{
		if (('A' <= s[i] && s[i] <= 'Y')
		     || ('a' <= s[i] && s[i] <= 'y'))// a-y,A-Y   
		{
			s[i] += 1; 
		}
		if(s[i] == 'z' || s[i] == 'Z')
		{
			s[i] -= 25;
		}
		
		i++;
	}
}

int main()
{
	char a[80];
	
	printf("Please enter an string(len<80):
"); scanf("%s",&a); inv(a); printf("%s",a); return 0; }