Advertisement
noler89

Untitled

Apr 27th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include<map>
  2. #include<string>
  3. #include<iostream>
  4. #include<algorithm>
  5. #include<fstream>
  6. using namespace std;
  7. int main(int argc, char **argv){
  8. setlocale(LC_ALL, "rus");
  9. map<string, string>dict;
  10. fstream fs(argv[1]);
  11. if (!fs.is_open()){
  12. cout << "Can not open file" << endl;
  13. return 1;
  14. }
  15. while (!fs.eof()){
  16. char eng[256], rus[256];
  17. fs.getline(eng, 256, '$');
  18. fs.getline(rus, 256);
  19. string engword(eng), rusword(rus);
  20. dict[engword] = rusword;
  21. }
  22. fs.close();
  23. map<string, string>::iterator it = dict.begin();
  24. for (int i = 0; i<30; i++, it++){
  25. cout << it->first << "\t" << it->second << endl;
  26. }
  27. system("pause");
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement