#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX_ROW 5
int main() {
printf(“输入字符串:\n”);
char arr[MAX_ROW][1000];
for (int i = 0; i < MAX_ROW; i++) {
fgets(arr[i], 1000, stdin);
}
int max = 0;
int j = 0;
for (int j = 1; j < MAX_ROW; j++) {
if (strlen(arr[j]) >= strlen(arr[max])) {
max=j;
}
}
printf(“最长字符串是:\n”);
fputs(arr[max], stdout);
system(“pause”);
return 0;
}
C语言输出最长字符串
最新推荐文章于 2023-08-13 10:35:42 发布