#ifdef _WIN32 #include #else #include #endif #include #include using namespace std; class GenrateShape { public: void SqaureShape(int length) { for (int row = 1; row <= length; row++) { sleep (1); for (int col = 1; col <= length; col++) { cout << "p"<< " "; } cout << endl; } } void TriangleShape(int length) { for (int i = 1; i <= length; i++) { sleep(1); for (int j = length - i; j > 0; j--) cout << " "; for (int b = 1; b <= i; b++) cout << "p" << " "; cout << endl; } } void pentagonShape(int length) { TriangleShape(length); SqaureShape(length); } }; int main() { int length = 13; GenrateShape shape; shape.pentagonShape(length); return 0; } DESIGN (ALGORITHM): On a piece of paper (or word processor), write down the algorithm, or sequence of steps, that you will use to solve the problem. You may think of this as a “recipe” for someone else to follow. Continue to refine your “recipe” until it is clear and deterministically solves the problem. Be sure to include the steps for prompting for input, performing calculations, and displaying output. You should attempt to solve the problem by hand first (using a calculator as needed) to work out what the answer should be for a few sets of inputs. Type these steps and calculations into a document (i.e., Word, text, or PDF) that will be submitted along with your source code. Note that if you do any work by hand, images (such as pictures) may be used, but they must be clear and easily readable. This document shall contain both the algorithm and any supporting hand-calculations you used in verifying your results.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

I have to write an algorithm for the code I made, so please help me.

 

#ifdef _WIN32
#include <Windows.h>
#else
#include <unistd.h>
#endif
#include <iostream>
#include <cstdlib>

using namespace std;

class GenrateShape {        
  public:              
    void SqaureShape(int length) {  
      for (int row = 1; row <= length; row++)
        {
            sleep (1);
            for (int col = 1; col <= length; col++)
            {
                cout << "p"<< " ";
            }
                cout << endl;
        }
    }
    
    
    void TriangleShape(int length) {  
      for (int i = 1; i <= length; i++)
        {
            sleep(1);
            for (int j = length - i; j > 0; j--)
                cout << " ";
            for (int b = 1; b <= i; b++)
                cout << "p" << " ";
                cout << endl;
        }
    }
    
    void pentagonShape(int length) {  
      TriangleShape(length);
      SqaureShape(length);
    }
};


int main()
{
    int length = 13;
    
    GenrateShape shape;
    

    shape.pentagonShape(length);
    
    return 0;
}

 

DESIGN (ALGORITHM):
On a piece of paper (or word processor), write down the algorithm, or sequence of steps, that you will
use to solve the problem. You may think of this as a “recipe” for someone else to follow. Continue to
refine your “recipe” until it is clear and deterministically solves the problem. Be sure to include the steps
for prompting for input, performing calculations, and displaying output.
You should attempt to solve the problem by hand first (using a calculator as needed) to work out what
the answer should be for a few sets of inputs.
Type these steps and calculations into a document (i.e., Word, text, or PDF) that will be submitted along
with your source code. Note that if you do any work by hand, images (such as pictures) may be used, but
they must be clear and easily readable. This document shall contain both the algorithm and any supporting
hand-calculations you used in verifying your results. 

 

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education