这道题目简单,没什么好说的。
Post Code:
#include <iostream>
using namespace std;
int main(){
char ch[101];
char max;
while(gets(ch)){
max=ch[0];
int len=strlen(ch);
for(int i=0;i<len;i++){
if(ch[i]>max)
max=ch[i];
}
for(int j=0;j<len;j++){
printf(ch[j]==max?"%c(max)":"%c",ch[j]);
}
printf("\n");
}
return 0;
}
本文详细介绍了如何使用C++编程语言通过`gets()`函数读取字符串,并遍历该字符串以查找最大字符,最后输出字符串中每个字符,条件是它们等于最大字符。通过实例演示了字符比较和循环的基本用法。
2840

被折叠的 条评论
为什么被折叠?



