@mibin
49 / 49 / 4
Регистрация: 21.10.2009
Сообщений: 272
|
29.11.2013, 10:47
|
|
Как-то так
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
30
31
32
33
34
35
36
37
38
| #include <iostream>
#include <string>
using namespace std;
int main()
{
string str = "hfhfh bdfhb eeee e ee e ee e e";
int prob;
int maxprob;
int e;
bool be;
prob = 0;
e = 0;
maxprob = 0;
be = false;
for (int i = 0; i < str.length() ; i++) {
if (str[i] == ' ') prob++;
else prob = 0;
if ( prob > maxprob ) maxprob = prob;
if (str[i] == 'e') e++;
else e = 0;
if ( e == 5 ) be = true;
}
cout << "E = 5 " << be << endl;
cout << "Probel = " << maxprob << endl;
return 0;
} |
|
0
|