Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- using namespace std;
- int main(int argc, char** argv) {
- map <string, string> slownik;
- slownik["january"] = "styczen";
- slownik["february"] = "luty";
- slownik["march"] = "marzec";
- slownik["april"] = "kwiecien";
- slownik["may"] = "maj";
- slownik["june"] = "czerwiec";
- slownik["july"] = "lipiec";
- slownik["august"] = "sierpien";
- slownik["september"] = "wrzesien";
- slownik["october"] = "pazdziernik";
- int decision;
- do{ system("CLS");
- cout << "Slownik:"<<endl<<"------------"<<endl;
- map<string, string>::iterator it;
- it=slownik.begin();
- // for(cur=slownik.begin();cur!=slownik.end();cur++)
- while(it!=slownik.end()){
- cout << it->first << "=" << it->second <<endl;
- ++it;
- }
- cout << "--------------------" <<endl;
- cout << slownik.size() <<endl;
- cout << "dodaj nowe tlumaczenie(1)" <<endl;
- cout << "przelumacz angielskie slowo(2)" <<endl;
- cout << "KONIEC(0)" <<endl;
- cin >> decision;
- switch(decision){
- case 1:{ string a,pl;
- cout << "po ang:"<<endl;
- cin >> a;
- cout << "po polsku:" <<endl;
- cin >> pl;
- slownik.insert(make_pair(a,pl));
- break;
- }
- case 2:{
- string a;
- cout << "Jakie slowo chcesz przetlumaczyc? :"<<endl;
- cin >>a;
- it = slownik.find(a);
- if(it!=slownik.end())
- cout << it->second<<endl;
- else cout << "NIE MA" <<endl;
- system("PAUSE");
- break;
- }
- default :{
- break;
- }
- }
- }while(decision);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement