|
发表于 2022-4-13 11:18:43
|
显示全部楼层
//默默研究了一会,新手学习中
#include <iostream>
#include"THchar.h"
using namespace std;
int num = 0;
char str_num[100] = { "hello,friends ,my name is cctry.com what is you name? \0" };
int main()
{
for (int idx = 0; idx < 99; ++idx)
{
if (str_num[idx] == 'i' || str_num[idx] == 'e')
{
str_num[idx] = '@';
++num;
}
else
{
continue;
}
};
cout << "字符数组的值是:" << str_num << endl;
cout << "2:将i或者I替换了" << num << "次" << endl;
return 0;
} |
|