Что в коде не так? #include #include #include using namespace std; int main() { string...

0 голосов
116 просмотров

Что в коде не так?

#include
#include
#include
using namespace std;
int main() {
string s;
vector vowels = ('a','e','i','o','u','y');
cin >> s;
int count_letters = 0;
int count = 0;
int state = -1;
int c = state;
for(int i = 0 ;i < s.length(); i++, c = state) {
if(find(vowels.begin(),vowels.end(),s[i])!= vowels.end())
state = 0;
else state = 1;
if(c==state) count_letters++;
if(count_letters == 3) {
count_letters = 1;
count++;
}
}
cout << count ;<br> }


In function 'int main()':
conversion from char to non-scalar type requested
cin was not declared in this scope
cout was not declared in this scope


Информатика (922 баллов) | 116 просмотров
Дан 1 ответ
0 голосов
Правильный ответ

#include
#include
#include
using namespace std;

int main() {
string s; 
vector vowels = {'a','e','i','o','u','y'};
cin >> s; 
int count_letters = 0; 
int count = 0; 
int state = -1; 
int c = state; 
for(int i = 0 ;i < s.length(); i++, c = state) {
  if(find(vowels.begin(),vowels.end(),s[i]) != vowels.end()) 
  state = 0;
  else state = 1; 
  if(c==state) count_letters++; 
  if(count_letters == 3) { 
    count_letters = 1;
    count++; 
  }

cout << count ;<br>}

(194k баллов)