Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <map>
- #include <string>
- #include <vector>
- using namespace std;
- std::fstream polskie;
- std::fstream angielskie;
- /*typedef map<string,string> StringFloatMap;
- StringFloatMap napol;
- StringFloatMap::iterator pol;*/
- void menu()
- {
- cout << "Menu:" << endl;
- cout << "1) Przeglad slowek" << endl;
- cout << "2) Dodawanie slowek" << endl;
- cout << "3) Usuwananie slowek" << endl;
- cout << "4) Test" << endl;
- cout << "5) Koniec" << endl;
- }
- void jeden()
- {
- /*for (pol = napol.begin(); pol != napol.end(); ++pol) {
- cout << "ANG: \"" << pol->first << "\" "
- << "POL: " << pol->second << endl;*/
- cout << "Oto twoja lista slowek:" << endl;
- polskie.open ("polskie.txt", std::fstream::in);
- angielskie.open ("angielskie.txt", std::fstream::in);
- string a,b;
- while(polskie >> a && angielskie >> b)
- {
- cout << a << " "<< b << endl;
- }
- polskie.close();
- angielskie.close();
- }
- void dwa()
- {
- string a,b;
- cout << "Jakie slowka chcesz dodac?" << endl;
- cout << "Polskie slowo: \n";
- cin >> a;
- cout << "Angielskie slowo: \n";
- cin >> b;
- polskie.open ("polskie.txt", std::fstream::app);
- angielskie.open ("angielskie.txt", std::fstream::app);
- polskie << a << endl;
- angielskie << b << endl;
- cout << "ok \n";
- /*napol["Monday"] = "Poniedzialek";
- napol["Tuesday"]= "Wtorek";
- napol["STFU"]= "Zamknij morde";
- napol["Wednesday"]="Sroda";
- napol["Thursday"]="Czwartek";
- napol["Friday"]="Piatek";*/
- polskie.close();
- angielskie.close();
- }
- void trzy()
- {
- vector<string> vpol;
- vector<string> vang;
- vector<string>::iterator p;
- vector<string>::iterator an;
- string a,b;
- int i = 1;
- polskie.open ("polskie.txt", std::fstream::app);
- angielskie.open ("angielskie.txt", std::fstream::app);
- while(polskie >> a && angielskie >> b)
- {
- vpol.push_back(a);
- vang.push_back(b);
- }
- an = vang.begin();
- cout << "Ktory element chcesz usunac?:";
- for (p = vpol.begin(); p != vpol.end(); p+= a.size())
- {
- a = *p;
- b = *an;
- cout << i << ". " << a << " " << b << endl;
- an += b.size();
- i++;
- }
- polskie.close();
- angielskie.close();
- }
- int main()
- {
- menu();
- int x = 1;
- cout << endl;
- //dwa();
- //jeden();
- /*map<string,string>naang;
- naang["Poniedzialek"] = "Monday";
- naang["Wtorek"]= "Tuesday";
- naang["Zamknij morde"]= "STFU";
- naang["Sroda"]="Wednesday";
- naang["Czwartek"]="Thursday";
- naang["Piatek"]="Friday";*/
- while(x != 0)
- {
- switch(getchar())
- {
- case '1':
- jeden();
- break;
- case '2':
- dwa();
- break;
- case '3':
- trzy();
- break;
- case '4':
- break;
- case '5':
- return 0;
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement