错不灰心,千错成王,万错成神。随便写了个,如下
#include<stdio.h>
#include<string.h>
int main(void)
{
char s[20];
int n;
printf("Enter letter:");
gets(s);
n=strlen(s);
if((s[n-1]=='s'||s[-1]=='x')||(s[n-2]=='s'&&s[n-1]=='h')||(s[n-2]=='c'&&s[n-1]=='h'))
printf("%s\n",strcat(s,"es"));
else if(s[n-1]=='o')
printf("%s\n",strcat(s,"es"));
else printf("%s\n",strcat(s,"s"));
return 0;
}