@MrCold
859 / 757 / 71
Регистрация: 11.01.2012
Сообщений: 1,942
|
14.11.2012, 20:30
|
|
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
| #include <iostream>
#include <fstream>
#include <string>
int main()
{
std::ifstream a("text.txt");
int i=0, m=0;
std::string slovo, text[500];
int fpos ;
while(a >> slovo)
{
while ((fpos = slovo.find_first_of(",.!?")) != std::string::npos)
slovo.erase( fpos, 1);
text[i] = slovo;
i++;
if(text[0] == slovo)
m++;
};
std::cout << " "<< m<< " slov, takih zhe kak i pervoje: "<<text[0] << std::endl;
a.close();
return 0;
} |
|
0
|