1 //输入N个字符,查找最大的字符串 2 #include<stdio.h> 3 #include<string.h> 4 int main(){ 5 char s[6][100]; 6 printf("请输入6个字符串\n"); 7 for(int j=0;j<6;j++){ 8 gets(s[j]); 9 } 10 int max=0; 11 for(int i=1;i<6;i++){ 12 if( strcmp(s[max],s[i])<0 ){ 13 max=i; 14 } 15 } 16 printf("最大的字符串是%d\n",max); 17 return 0; 18 }
C语言学习(15)
猜你喜欢
转载自www.cnblogs.com/Tobi/p/9237559.html
今日推荐
周排行