Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. using namespace std;
  4.  
  5. int main(int argc, char** argv) {
  6.  
  7. map <string, string> slownik;
  8. slownik["january"] = "styczen";
  9. slownik["february"] = "luty";
  10. slownik["march"] = "marzec";
  11. slownik["april"] = "kwiecien";
  12. slownik["may"] = "maj";
  13. slownik["june"] = "czerwiec";
  14. slownik["july"] = "lipiec";
  15. slownik["august"] = "sierpien";
  16. slownik["september"] = "wrzesien";
  17. slownik["october"] = "pazdziernik";
  18. int decision;
  19. do{ system("CLS");
  20. cout << "Slownik:"<<endl<<"------------"<<endl;
  21. map<string, string>::iterator it;
  22. it=slownik.begin();
  23. // for(cur=slownik.begin();cur!=slownik.end();cur++)
  24. while(it!=slownik.end()){
  25.  
  26. cout << it->first << "=" << it->second <<endl;
  27. ++it;
  28. }
  29. cout << "--------------------" <<endl;
  30. cout << slownik.size() <<endl;
  31. cout << "dodaj nowe tlumaczenie(1)" <<endl;
  32. cout << "przelumacz angielskie slowo(2)" <<endl;
  33. cout << "KONIEC(0)" <<endl;
  34. cin >> decision;
  35. switch(decision){
  36. case 1:{ string a,pl;
  37. cout << "po ang:"<<endl;
  38. cin >> a;
  39. cout << "po polsku:" <<endl;
  40. cin >> pl;
  41. slownik.insert(make_pair(a,pl));
  42. break;
  43. }
  44. case 2:{
  45. string a;
  46. cout << "Jakie slowo chcesz przetlumaczyc? :"<<endl;
  47. cin >>a;
  48. it = slownik.find(a);
  49. if(it!=slownik.end())
  50. cout << it->second<<endl;
  51. else cout << "NIE MA" <<endl;
  52. system("PAUSE");
  53.  
  54. break;
  55. }
  56. default :{
  57.  
  58. break;
  59. }
  60. }
  61. }while(decision);
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. return 0;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement