#include "stdio.h"
#include
int main(int argc,char *argv[]){
char s[101],st[101];
int n,ln,t;
printf("Please enter n(int n>0)...\n");
if(scanf("%d",&n)!=1 || n<1){
printf("Input error, exit...\n");
return 0;
}
ln=100;
while(n--){
scanf("%100s",s);
if((t=strlen(s))ln=t;
strcpy(st,s);
}
}
printf("The shortest string is '%s'.\n",st);
return 0;
}
运行们例:
#include
#include
int main()
{int n,i,min=0;
scanf("%d",&n);
getchar();a
char s[n][200];
for(i=0;i{gets(s[i]);
if(strlen(s[i])}
printf("-------\n%s\n",s[min]);
return 0;
}
#include
#include
void main() { char s0[256],s1[256]; int n,i,m,k;
scanf("%d",&n); m=256;
for ( i=0;igets(s1); k=strlen(s1); if ( k }
printf("%s\n",s0);
}