HDU 2025 查找最大元素

 1 #include<stdio.h>

 2 #include<stdlib.h>

 3 int main()

 4 {

 5     char t[128];

 6     char max;

 7     int i;

 8     while(gets(t))

 9     {

10         for(max=i=0;t[i]!='\0';i++)

11         {

12             if(t[i]>max)

13             max=t[i];

14         }

15         for(i=0;t[i]!='\0';i++)

16         {

17             putchar(t[i]);

18             if(t[i]==max)

19             printf("(max)");

20         }

21         putchar('\n');

22     }

23     return 0;

24 }

你可能感兴趣的:(HDU)