Advertisement
Sanlover

Untitled

Oct 25th, 2021
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int previous, temp;
  6. bool isDone = false, isGrowing = true;
  7.  
  8. cout << "Start entering your numbers:" << endl;
  9. cin >> previous;
  10. if (previous == 0) {
  11. cout << "No numbers in your subsequence";
  12. return 0;
  13. }
  14.  
  15. while (isDone == false) {
  16. cin >> temp;
  17. if (temp == 0) {
  18. isDone = true;
  19. } else {
  20. if (previous > temp) {
  21. isGrowing = false;
  22. }
  23. previous = temp;
  24. }
  25. }
  26.  
  27. cout << "Your subsequence is ";
  28. if (isGrowing == true) {
  29. cout << "growing";
  30. } else {
  31. cout << "not growing";
  32. }
  33.  
  34. return 0;
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement