pragma warning disable 4786 include iostream include map include strin

  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
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#pragma warning(disable:4786)
#include <iostream>
#include <map>
#include <string>
#include <fstream>
#include <iomanip>
#include <vector>
#include <windows.h>
#include <shlwapi.h>
using namespace std;
int main()
{
typedef multimap<string,string> Mr;
typedef multimap<string,string> ::iterator it;
Mr dict;
string str1;
string str2;
ifstream fp1;
ifstream fp2;
fp1.open("C:/Info1.txt");
fp2.open("C:/Info2.txt");
while (!fp1.eof()&&!fp2.eof())
{
fp1>>str1;
fp2>>str2;
dict.insert(pair<string,string>(str1,str2));
}
//////////////////////////////////вывод на экран всего словаря/////////////////////////////////////
Mr::iterator pos;
cout.setf(ios::left,ios::adjustfield);
cout<<' '<<setw(10)<<"eng"<<"russ"<<endl;
cout<<"--------------------"<<endl;
for(pos=dict.begin();pos!=dict.end();++pos)
{
cout<<' '<<setw(10)<<pos->first.c_str()/*<<pos->second*/<<endl;
}
// fp1.close();
//fp2.close();
/////////////////////////////////////////////поиск слова в словаре//////////////////////////////
string word;
/* int kol=0;
cout<<"---------------------"<<endl;
cout<<"Enter word for translation eng-rus"<<endl;
cin>>word;
for(pos=dict.begin();pos!=dict.end();++pos)
{
if(pos->first==word)
{
kol++;
cout<<" "<<pos->second<<endl;
}
}
if(kol==0)
cout<<"Sorry,word don't found"<<endl;
kol=0;
cout<<"---------------------"<<endl;
cout<<"Enter word for translation rus-eng"<<endl;
cin>>word;
for(pos=dict.begin();pos!=dict.end();++pos)
{
if(pos->second==word)
{
kol++;
cout<<" "<<pos->first<<endl;
}
}
if(kol==0)
cout<<"Sorry,word don't found"<<endl;*/
/////////////////////////////////////////cписок слов для учебы///////////////////////////
/* typedef map<string,string> map;
map mmap;
string word2;
ofstream fout("list1.txt");
ofstream fout2("list2.txt");
int quant;
cout<<"Enter quantity of word"<<endl;
cin>>quant;
cout<<"Enter english word"<<endl;
for(int i=0;i<quant;i++)
{
cin>>word;
for(pos=dict.begin();pos!=dict.end();++pos)
{
if(pos->first==word)
{ word2=pos->second;
mmap[word]=word2;
koll[i]=0;
fout<<word<<endl;
fout2<<word2<<endl;
cout<<"Your add new word in list"<<endl;
break;
}
}
}
*/
///////////////////////////////////////работа со списком слов///////////////////////////////////
vector <string> vec1;
vector <string>::iterator it1;
vector <string> vec2;
vector <string>::iterator it2;
it1=vec1.begin();
it2=vec2.begin();
string koll2;
int *koll=new int [4];
ifstream fp3;
ifstream fp4;
fp3.open("C:/list1.txt");
fp4.open("C:/list2.txt");
while (!fp3.eof()&&!fp4.eof())
{
fp3>>str1;
vec1.push_back(str1);
fp4>>str2;
vec2.push_back(str2);
}
ifstream fp5;
fp5.open("C:/kollich.txt");
int temp=0;;
while(!fp5.eof())
{
fp5>>koll2;
int koll3=atoi(koll2.c_str());
koll[temp]=koll3;
temp++;
}
cout<<"****************************"<<endl;
cout<<"Translate into russian"<<endl;
ofstream fo("C:/kollich.txt");
for( int i=0;i<2;i++)
{
cout<<setw(10)<<vec1[i];
cin>>str1;
if(str1==vec2[i])
{ cout<<"-------TRUE----------"<<endl;
koll[i]++;
fo<<koll[i]<<endl;
}
else
{ cout<<"------WRONG----------"<<endl;
fo<<koll[i]<<endl;
}
if(koll[i]>2)
{
vec1.erase(it1+i);
vec2.erase(it2+i);
}
}
return 0;
}