首页 > 编程语言 > 详细

Problem H: 零起点学算法109——单数变复数

时间:2018-12-09 15:54:21      阅读:234      评论:0      收藏:0      [点我收藏+]
#include <stdio.h>
#include<string.h>
int main(void)
{
    int n;
    char word[100];
    scanf("%d",&n);
    getchar();
    int i;
    while(n!=0)
    {
        gets(word);
        int k=strlen(word);
        if(word[k-1]==‘y‘)
            strcat(word,"es");
        else if(word[k-2]==‘s‘||word[k-1]==‘x‘)
            strcat(word,"es");
        else if(word[k-2]==‘s‘&&word[k-1]==‘h‘)
            strcat(word,"es");
        else if(word[k-2]==‘c‘&&word[k-1]==‘h‘)
            strcat(word,"es");
        else if(word[k-1]==‘o‘)
            strcat(word,"es");
        else
            strcat(word,"s");
        puts(word);
        n--;
    }
    return 0;
}

似乎用printf提交ac不了,用put可以

Problem H: 零起点学算法109——单数变复数

原文:https://www.cnblogs.com/chenlong991223/p/10090787.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!