Advertisement
TheLegend12

Untitled

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