Advertisement
Guest User

Untitled

a guest
May 1st, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <set>
  3. #include <list>
  4. #include <stack>
  5. #include <utility>
  6. #include <string>
  7. #include <vector>
  8. #include <stdexcept>
  9.  
  10. enum class Boje {Herc, Karo, Pik, Tref};
  11.  
  12. /*std::pair<std::string, std::string> ImeKarte(int i, int j) {
  13. std::vector<std::string> ImenaBoja{'Herc', 'Karo', 'Pik', 'Tref'};
  14. std::vector<std::string> Brojevi{'2', '3,', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A'};
  15.  
  16. std::pair<std::string, std::string> vrati;
  17. vrati.first = ImenaBoja[i];
  18. vrati.second = Brojevi[j];
  19.  
  20. return vrati;
  21. }*/
  22.  
  23. std::list<std::set<Boje>> KreirajSpil() {
  24. std::set<Boje> SPIL;
  25.  
  26. for(int i(0); i<13; i++) {
  27. std::set<Boje> BojeKarti{Boje::Herc, Boje::Karo, Boje::Pik, Boje::Tref};
  28. SPIL.push_back(BojeKarti); //OVO NIJE PUSH_BACK TREBA NEŠTO DRUGO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  29. }
  30.  
  31. return SPIL;
  32. }
  33.  
  34. std::stack<std::pair<std::string, std::string>> IzbaciKarte(std::list<std::set<Boje>> &Spil, std::pair<int, int> &TrebaIzbaciti) {
  35. if(TrebaIzbaciti.first < 1 || TrebaIzbaciti.first > 52 || TrebaIzbaciti.second < 1) throw logic_error ("Neispravni elementi za izbacivanje!");
  36. if(Spil.size() != 13) throw logic_error ("Neispravna lista!");
  37.  
  38. std::stack<std::pair<std::string, std::string>> VratiIzbacene;
  39.  
  40. int IzbacenoKarata(0);
  41. while(IzbacenoKarata != TrebaIzbaciti.second) {
  42. std::list<std::set<Boje>>::iterator FUJ;
  43.  
  44. for(int i(0); i<4; i++) {
  45.  
  46. for(int j(0); j<13; j++) {
  47.  
  48.  
  49. }
  50. }
  51.  
  52.  
  53.  
  54. IzbacenoKarata++;
  55. }
  56.  
  57. return VratiIzbacene;
  58. }
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. void VratiPosljednjihNKarata (std::list<std::set<Boje>> &Spil, std::stack<std::pair<std::string, std::string>> &Stek, int n);
  66.  
  67. int main() {
  68. std::cout << "Zadaća 3, Zadatak 3";
  69. return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement