One Question of the Day 66

Question 66: There are 3 strings, ask to find the largest of them.
Insert picture description here
#include<stdio.h>
#include<string.h>
int main()
{ char str[3][20]; char string[20]; int i; for(i=0;i<3;i++) { gets(str[i]);//Enter a string per line break } if(strcmp(str[0],str[1])>0) strcpy(string,str[0]); else strcpy(string,str [1]); if(strcmp(str[2],string)>0) strcpy(string,str[2]); printf("The largest string of the three input strings is %s\n", string); }














Guess you like

Origin blog.csdn.net/drake_gagaga/article/details/114004345
Recommended