#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;
}