- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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 "stdafx.h"
#include<iostream>
#include<fstream>
#include<string>
#include<map>
#include<iomanip>
using namespace std;
int main()
{
string word;
setlocale(LC_ALL, "Russian");
char s[80];
fstream inOut;
multimap<string, int>my;
multimap<string, int>::iterator it;
inOut.open("text.txt", ios::in);
for (int i = 1; i < 40; i++) {
inOut.getline(s, 256);
char* pch;
pch = strtok(s, " ,-:;");
while (pch != NULL) {
word = string(pch);
my.insert(pair <string, int>(pch, i));
//cout << pch <<'\t'<<i<< endl;
pch = strtok(NULL, " ,-:");
}
}
inOut.close();
//cout << s;
for (it = my.begin(); it != my.end(); it++) {
cout.width(25);
cout << (*it).first <<setw(5) << (*it).second << endl;
}
system("pause");
return 0;
}