Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.  
  9. int rosnaco, malejaco, liczba_zestawow;
  10. cout << "Wprowadz liczbe zestawow: " << endl;
  11. cin >> liczba_zestawow;
  12.  
  13. for (int licznik = 0; licznik < liczba_zestawow; ++licznik) {
  14. int a, b;
  15. string sort;
  16.  
  17. cout << endl << "Podaj " << licznik+1 << " zestaw: " << endl;
  18. cin >> a >> b;
  19.  
  20. cout << "Rosnaco czy malejaco?" << endl;
  21. cin >> sort;
  22.  
  23. cout << endl << "Wynik: " << endl;
  24. cout << sort;
  25. if (sort == "rosnaco") {
  26.  
  27. if (a > b) {
  28. for (int n = a; n <= b; n++) {
  29. cout << n << endl;;
  30. }
  31. } else {
  32. cout << a;
  33. }
  34. }
  35.  
  36. else if (sort == "malejaco") {
  37. if (a < b) {
  38. for (int i = b; i >= a; i--) {
  39. cout << i << endl;
  40. }
  41. }
  42. }
  43.  
  44. else {
  45. cout << "zle";
  46. }
  47.  
  48. }
  49.  
  50. system("PAUSE");
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement