#include<stdio.h>
#include<ctype.h>
/*
I don't understand that av[ac]会自动添加下面的内容
1q
XDG_SESSION_ID=2291
HOSTNAME=shenhao
TERM=xtermSHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=101.230.196.33
52079 22SSH_TTY=/dev/p129
I have doubted that av[ac-1]
but adding sprintf is successful;
*/
//my getchar using is error
/*
int getchar(void)
{
static char buf[BUFSIZ];
static char* bb=buf;
static int n=0;
if(n==0)
{
n=read(0,buf,BUFSIZ);
bb=buf;
}
return(--n>=0)?(unsigned char)*bb++:EOF;
}
*/
//We can find value of return is int and EOF 's value is -1
//so can't use NULL
int mian()
{
char c;
if((c = getchar()) == NULL)
return -1;
else
}
//that is right code
int main()
{
int c;
while ( ( c=getchar() ) != EOF ){
if ( c == 'z' )
c = 'a';
else if (islower(c))
c++;
putchar(c);
}
}
//that is my implement
int main(int ac, char* av[])
{
int i = 0;
char buf[20];
if(ac == 1)
return -1;
while (1)
{
sprintf(buf,"%s",av[ac-1]);
if( buf[i] == 'z')
{
buf[i] = 'a';
}
else
{
buf[i] ++;
if(buf[i] == 'Q' || buf[i] == 'q')
break;
}
i++;
}
printf("%d\n",i);
fprintf(stdout,"%s",buf);
return 0;
}