Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. //determins how high we count(2^degree)
  8. int degree=6;
  9.  
  10. for(int i=0;i<=degree;i++)
  11. {
  12. //re initialize variables for 1 assension, dcension loop
  13. int value = 1; //stores the actual changeing numbers
  14. int valueCounter; //have a value that we can easily loop down through later
  15. for(valueCounter = 0; valueCounter<i;valueCounter++
  16. {
  17. cout<<value; //display the ascending numbers
  18. value *= 2; //multiply the current value by 2 and store it back again
  19. }
  20.  
  21. //prevent a repeat of the max number and remove the last increase:
  22. value /= 4;
  23.  
  24. for(valueCounter=(valueCounter-2);valueCounter>0;valueCounter--)
  25. {
  26. cout<<value;
  27. value /= 2; //divide down
  28. }
  29. }
  30. system("pause");
  31.  
  32. retrun 0;
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement