首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

hdu2025 查寻最大元素

2013-03-25 
hdu2025 查找最大元素原题: #include stdio.hint main(){char t[128]char maxint iwhile (gets(t)){f

hdu2025 查找最大元素

原题:

 

#include <stdio.h>int main(){ char t[128]; char max; int i; while (gets(t)) { for (max = i = 0 ; t[i] ; i++) { if (t[i] > max) max = t[i]; } for (i = 0 ; t[i] ; i++) { putchar(t[i]); if (t[i] == max) printf("%s", "(max)"); } putchar('\n'); } return 0;}


 

 

 

 

 

热点排行