Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. /**
  2. *
  3. * Solution to homework task
  4. * Introduction to programming course
  5. * Faculty of Mathematics and Informatics of Sofia University
  6. * Winter semester 2017/2018
  7. *
  8. * @author NATALIJA STOJANOVA
  9. * @idnumber 855301
  10. * @task 6
  11. * @compiler GCC
  12. *
  13. */
  14. #include <iostream>
  15. using namespace std;
  16. int main ()
  17. {
  18. int Number=0,AuxiliaryVariable=0,Counter=0,Counter2=1;
  19. cout<<"Enter integers and press ENTER, when you want to finish the row enter 0 or negative number "<<endl;
  20. cin>>Number;
  21. cout<<Number;
  22. while (Number!=AuxiliaryVariable)
  23. {
  24. AuxiliaryVariable=Number;
  25. cin>>Number;
  26.  
  27.  
  28. if(Number<=0)
  29. {
  30. break;
  31. }
  32. if (Number>AuxiliaryVariable)
  33. Counter++;
  34. if (Number<AuxiliaryVariable)
  35. Counter=Counter+0;
  36. Counter2++;
  37.  
  38. if(Counter%(Counter2-1)!=0)
  39. {
  40. cout<<"Your row is undefined"<<endl;
  41. break;
  42. }
  43. }
  44.  
  45. if (AuxiliaryVariable!=Number)
  46. {
  47. if (Counter==0)
  48. cout<<"Your row is decreasing"<<endl;
  49. if ((Counter+1)%Counter2==0)
  50. cout<<"Your row is increasing"<<endl;
  51. }
  52. else
  53. cout<<"Your row is undefined"<<endl;
  54. return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement