N
news.hku.hk
how to count the occurance of a character in a string ?
e.g.
#include <iostream>
#include <string>
using namespace std;
int main (){
string text = "abc, def, ghi, jkl, mno";
// how to count the number of occurance of "," in text ????
return 0;
}
thanks
e.g.
#include <iostream>
#include <string>
using namespace std;
int main (){
string text = "abc, def, ghi, jkl, mno";
// how to count the number of occurance of "," in text ????
return 0;
}
thanks