Answers for "c++ count counting how many times a appears in a string"

C++
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
0

print counting in c++

#include<iostream>
using namespace std;

int main()
{
  int n;
  cin>>n;
  for (int i=0; i<n; i++)
  {
    cout<<i<<"\n";
  }
  return 0;
}
Posted by: Guest on May-10-2021

Code answers related to "c++ count counting how many times a appears in a string"

Browse Popular Code Answers by Language