Advertisement
Guest User

Untitled

a guest
Feb 17th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <algorithm>
  5. #include <ctype.h>
  6. using std::cout;
  7. using std::endl;
  8. using std::string;
  9.  
  10. struct pyt {
  11. string pytanie;
  12. string odpowiedz;
  13. string reakcja;
  14. };
  15.  
  16. int main()
  17. {
  18. std::vector<pyt> jeeebac;
  19.  
  20. pyt pytanie1;
  21. pytanie1.odpowiedz = "Tak";
  22. pytanie1.pytanie = "Czy jebac te studia?";
  23. pytanie1.reakcja = "No kurwa dobrze";
  24.  
  25. pyt pytanie2;
  26. pytanie2.odpowiedz = "Nie";
  27. pytanie2.pytanie = "tutaj pytanie";
  28. pytanie2.reakcja = "elegancko";
  29.  
  30. jeeebac.push_back(std::move(pytanie1));
  31. jeeebac.push_back(std::move(pytanie2));
  32.  
  33.  
  34.  
  35. int iloscpytan{ 2 };
  36.  
  37. for (int i = 0; i < iloscpytan; i++)
  38. {
  39. cout << jeeebac[i].pytanie << endl;
  40. string odp{};
  41.  
  42. while (std::cin >> odp)
  43. {
  44. std::transform(odp.begin(), odp.end(), odp.begin(), ::tolower);
  45. std::transform(jeeebac[i].odpowiedz.begin(), jeeebac[i].odpowiedz.end(), jeeebac[i].odpowiedz.begin(), ::tolower);
  46.  
  47.  
  48. if (odp == jeeebac[i].odpowiedz)
  49. {
  50. cout << jeeebac[i].reakcja << endl;
  51. break;
  52. }
  53. else
  54. {
  55. cout << "Zle !" << endl;
  56. odp = {};
  57. continue;
  58. }
  59. }
  60.  
  61. _sleep(1000);
  62. system("CLS");
  63. }
  64.  
  65. system("PAUSE");
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement