C++ Question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C++ Question

Write a function that takes an input string. As output, add and return letter by letter to string. example: input: Code output : CCoCodCode

11th Mar 2023, 12:57 PM
Parsa Nasirikhah
1 Answer
0
std::string repeatString(std::string input){ std::string output; for(int i = 0; i < input.length(); i++){ for(int j = 0; j <= i; j++){ output += input[j]; } } return output; }
11th Mar 2023, 1:09 PM
István