@zitxbit
89 / 741 / 75
Регистрация: 11.04.2012
Сообщений: 971
|
09.04.2014, 09:34
|
|
C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| #include <stdio.h>
#include <conio.h>
#include <locale.h>
#include <string.h>
#include <wchar.h>
int main(int argc, char* argv[])
{
setlocale(LC_ALL,"Russian");
static wchar_t str[256] = L"Цыганова\0";
int count = 0;
wchar_t wpchars[] = L"ауоыиэяюёе";
for (int index = 0; str[index] != '\0'; index++)
{
bool is_vowel = false;
for (int nindex = 0; wpchars[nindex] != '\0' && !is_vowel; nindex++)
is_vowel = (wpchars[nindex] == str[index]) ? 1 : 0;
if (is_vowel != false) count++;
}
wprintf(L"string = %s\nvowels count = %d\n",str,count);
_getch();
return 0;
} |
|
0
|