#include <iostream>
#include <string>
using namespace std;
void countChars(char (&arr)[8]) {
string vowelsArr = "aeiou";
char *ptr = arr;
int total = 0;
int vowels = 0;
for (int i = 0; i < 8; ++i) {
++total;
if (vowelsArr.find(*ptr) != -1) {
++vowels;
}
++ptr;
}
cout << "total: " << total << endl;
cout << "vowels: " << vowels << endl;
}
int main() {
char a[] = {'d', 'f', 'a', 'x', 'e', 'r', 'b', 'u'};
countChars(a);
}
Comments
Leave a comment