#include <iostream> using namespace std; int kol(char * str); int main() { char *str = new char [999]; cin>>str; cout<<kol(str); } int kol(char * str) { char buf[] = "bcdfghklmnpqrstvwxyz"; int count = 0; for(int i = 0; str[i] != '\0'; i++) { for(int j = 0; buf[j] != '\0'; j++) { if(str[i] == buf[j]) { count++; break; } } } return count; }
#include <iostream> #include <string> using namespace std; int kol(string str); int main(int argc, char * argv[]) { string slovo; cout<<"Vvedite slovo>"; cin>>slovo; cout<<kol(slovo); return 0; } int kol(string str) { string bukv = "AEIOUY"; int found = 0; int i = 0; int i2; int c = bukv.size(); while(i < str.size()) { i2 = 0; while(i2 < c) { if(str[i] == bukv[i2]) { found++; } i2++; } i++; } return found; }