11 Star 31 Fork 7

duchenhong/北航学院2020C语言程序设计例程

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
未命名1.c 697 Bytes
一键复制 编辑 原始数据 按行查看 历史
duchenhong 提交于 2020-04-29 21:25 . 修改轴对称图形
#include <stdio.h>
#include <string.h>
int isSpace(char c);
int main()
{
char arr_1[1000], arr_2[1000];
char *in_line = arr_1, *longest = arr_2, *temp;
int max_len = 0, len = 0;
while (fgets(in_line, 1000, stdin) != NULL)
{
for (len = strlen(in_line); len > 0 && isSpace(in_line[len - 1]); len--)
{
in_line[len - 1] = 0;
}
if (len >= max_len)
{
max_len = len;
temp = in_line;
in_line = longest;
longest = temp;
}
}
printf("%d %s#END", max_len, longest);
return 0;
}
int isSpace(char c)
{
return (c == ' ') || (c == '\n') || (c == '\t') || (c == '\r');
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/duchenhong/programming_routine_2020c.git
git@gitee.com:duchenhong/programming_routine_2020c.git
duchenhong
programming_routine_2020c
北航学院2020C语言程序设计例程
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385