current position:Home>I don't understand what this means!!

I don't understand what this means!!

2022-02-02 13:05:15 CSDN Q & A

Enter a string that ends with a carriage return , Find all of them u Letter ( Include case ), And replace it with a string “###”, Generate a new string , Output the newly generated string ( The input string remains unchanged , If there is no... In the input string u Letter , Then the new string is the same as the input string ).




Refer to the answer 1:
#include <iostream>#include <string>int main(){    std::string string;    std::getline(std::cin, string);    std::string new_string;    const char *p = string.c_str();    while (*p)    {        if (*p == 'u' || *p == 'U')            new_string += "###";        else            new_string += *p;        p++;    }    std::cout << new_string << std::endl;    return 0;}



Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202021305137360.html

Random recommended