Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <string>
- using namespace std;
- int main() {
- int numberOfLevels;
- int choice;
- // The menu output. Don't modify this, so that it outputs exactly as expected
- cout << "Program 1: Step Pyramids" << endl;
- cout << "Which option would you like?" << endl;
- cout << " 1. Display original graphic" << endl;
- cout << " 2. Display Step Pyramid" << endl;
- cout << "Your choice: ";
- cin >> choice;
- cout << endl;
- if (choice == 1){
- }
- if (choice == 2){
- cout << "How many levels should be in the step pyramid? ";
- cin >> numberOfLevels;
- int topOfPyramid = 12 + (6 * (numberOfLevels));
- cout << setw(topOfPyramid + 5) << " _______" << endl;
- cout << setw(topOfPyramid + 6) <<" |_______|" << endl;
- cout << setw(topOfPyramid + 6) <<" | ___ |" << endl;
- cout << setw(topOfPyramid + 8) <<"__|__[_]__|__" << endl;
- for (int i = 1; i <= numberOfLevels; i++){
- int numberOfLeftSideSpaces = 12 + (6 * (numberOfLevels - i));
- int spacesToStairs = 4 + 6 * (i - 1);
- cout << setw(numberOfLeftSideSpaces + 1) << "/" << setw(spacesToStairs + 5) << "|===|" << setw(spacesToStairs + 1) << "\\" << endl;
- cout << setw(numberOfLeftSideSpaces) << "/" << setw(spacesToStairs + 6) << "|===|" << setw(spacesToStairs + 2) << "\\" << endl;
- if (i != numberOfLevels){
- cout << setw(numberOfLeftSideSpaces - 4) << "+" << setfill('+') << setw(spacesToStairs+10) << "|===|" ;
- for(int i=0;i<spacesToStairs+6;i++) cout << "+";
- cout << setfill(' ')<< endl;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement