Advertisement
TheLegend12

Untitled

Sep 2nd, 2023
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main() {
  7. int numberOfLevels;
  8. int choice;
  9. // The menu output. Don't modify this, so that it outputs exactly as expected
  10. cout << "Program 1: Step Pyramids" << endl;
  11. cout << "Which option would you like?" << endl;
  12. cout << " 1. Display original graphic" << endl;
  13. cout << " 2. Display Step Pyramid" << endl;
  14. cout << "Your choice: ";
  15. cin >> choice;
  16. cout << endl;
  17.  
  18. if (choice == 1){
  19.  
  20. }
  21.  
  22. if (choice == 2){
  23. cout << "How many levels should be in the step pyramid? ";
  24. cin >> numberOfLevels;
  25. int topOfPyramid = 12 + (6 * (numberOfLevels));
  26. cout << setw(topOfPyramid + 5) << " _______" << endl;
  27. cout << setw(topOfPyramid + 6) <<" |_______|" << endl;
  28. cout << setw(topOfPyramid + 6) <<" | ___ |" << endl;
  29. cout << setw(topOfPyramid + 8) <<"__|__[_]__|__" << endl;
  30.  
  31. for (int i = 1; i <= numberOfLevels; i++){
  32. int numberOfLeftSideSpaces = 12 + (6 * (numberOfLevels - i));
  33. int spacesToStairs = 4 + 6 * (i - 1);
  34. cout << setw(numberOfLeftSideSpaces + 1) << "/" << setw(spacesToStairs + 5) << "|===|" << setw(spacesToStairs + 1) << "\\" << endl;
  35. cout << setw(numberOfLeftSideSpaces) << "/" << setw(spacesToStairs + 6) << "|===|" << setw(spacesToStairs + 2) << "\\" << endl;
  36. if (i != numberOfLevels){
  37. cout << setw(numberOfLeftSideSpaces - 4) << "+" << setfill('+') << setw(spacesToStairs+10) << "|===|" ;
  38. for(int i=0;i<spacesToStairs+6;i++) cout << "+";
  39. cout << setfill(' ')<< endl;
  40. }
  41. }
  42. }
  43.  
  44.  
  45.  
  46.  
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement