Ксюнька Ксю
ОР
Олег Румянцев
#include
#include
using namespace std;
int count(string, char);
int main() {
cout << " Text?.. ";
string text;
getline(cin, text);
cout << " Simbol?.. ";
char simbol;
cin >> simbol;
int c = count(text, simbol);
cout << " Count = " << c<< endl;
cin.get(); cin.get();
return 0;
}
int count(string _str, char _ch) {
int c = 0;
int size = _str.size();
for (int n = 0; n < size; n++) if (_str[n] == _ch) ++c;
return c;
}
ММ
Марина Марина
int metod(unsigned char c,char* s)
{ int j=0;
int a[256];
for(j=0;j-256;a[j++]=0);
for(j=0;s[j];) a[s[j++]]++;
return a[c];
}
Похожие вопросы