@YouDoItWrong
47 / 47 / 7
Регистрация: 29.10.2011
Сообщений: 154
|
14.12.2011, 21:33
|
|
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
| #include <iostream>
#include <string>
using namespace std;
int main() {
string sl, s;
int i;
cout << "Vvedite stroku" << endl;
cin >> s;
sl.clear(); i = 1; s += '.';
do {
for( i = 0; i < s.length(); i++) {
if ((s[i]==' ') || (s[i]==',') || (s[i]==';') || (s[i]=='.') || (s[i]=='!') || (s[i]=='?')) {
if( sl[0] == sl[sl.length()-1]) {
cout << sl << endl;
sl.clear();
}
} else {
sl = sl + s[i];
}
}
i++;
} while( i > s.length() );
cin.get();
return 0;
} |
|
как то так помойму.
1
|