Answers for "repeat characters by count c++"

C++
3

repeat character n times c++

auto five_repeated_dots = std::string(5, '.');
Posted by: Guest on September-14-2020
2

string count occurrences c++

#include <algorithm>

std::string s = "a_b_c";
size_t n = std::count(s.begin(), s.end(), '_'); //n=2
Posted by: Guest on April-18-2021

Browse Popular Code Answers by Language