
10.12.2008, 16:53
|
|
Участник форума
Регистрация: 07.07.2008
Сообщений: 161
С нами:
9391926
Репутация:
234
|
|
PHP код:
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
string vowels = "aeiou";
int countvowels(const string& s)
{
int res = 0;
for(int i = 0; i < s.length(); i++)
for(int j = 0; j < vowels.length(); j++)
if (s[i] == vowels[j])
res++;
return res;
}
int main()
{
string a, res;
int max = -1;
while(getline(cin, a)) // читаем строку пока не встречаем символ перевода строки
{
if(a == "end")// end означает конец ввода
break;
cout << a << "\n";
cout << countvowels(a) << "\n";
if (countvowels(a) > max)
{
max = countvowels(a);
res = a;
}
}
cout << max << "\n" << res;
cin.get();
return 0;
}
|
|
|