Asslam o Alaikum!
I warmly welcome you to this publication which will be very interesting, I hope you all will read this post in excellent health conditions. Here will discuss some patterns that we can draw using the programming language c++. As I have already discussed in some publications about this verbiage it is very complicated. Barring its complication, it is very valid also in our life codings such as in financial management systems, google searching programs, website developments, games, blockchains, and managing systems use this language to operate and their coding is based on the verbiage.
We can draw different shapes and patterns by using the stars such as circles, triangles, and many other patterns using graphics or object-oriented programming. So I will discuss here the printing of the patterns of the pyramid in different characters, integers, or stars in the program. So let's start the discussion of printing the patterns adequately using the code of some lines in the c++ language.

In the developments of the websites and the programs behind our publication, we also code to draw the patterns in different languages such as python, HTML, java, and CSS and these pattern drawing required complete coding with sequence and logic we can also use the graphics to print pattern but here I will use only the code of some lines.
So foremost of all I will write the code and confer its working and the parameters used in it.
Code to print the pyramid in the Stars
int i, space, rowSize, k=0; |
cout<<"Enter the Number of Rows:: "; |
cout<<"\nPyramid of "<<rowSize<<" Rows or Lines:\n"; |
for(i=1; i<=rowSize; i++) |
for(space=1; space<=(rowSize-i); space++) |
So this is the code to print the pyramid of the stars. This was so simple we will discuss its working succinctly. Here I use the simple code of pyramid print which started with the creation of the variable and after the variable is created then the numbers are stored in it. Then I use the nested loop to create the size of the patterns such as the lines that we have taken from the user and according to the user input, the pyramid size will be designed.
PRINTING THE PYRAMID PATTREN ACCORDING TO THE USERS CHOICE
Here I am going to write a program that will take the input from the user and print or draw the pattern according to the user's choice such as the half pyramid, full pyramid, or inverted pyramid patterns according to the user's choice.
Such as I have to make the choices...
- Print Half Pyramid of Stars
- Print Inverted Half Pyramid of Stars
- Print Full Pyramid of Stars
- Print Inverted Full Pyramid of Stars
void invertedHalfPyramid(); |
void invertedFullPyramid(); |
cout<<"1. Print Half Pyramid of Stars\n"; |
cout<<"2. Print Inverted Half Pyramid of Stars\n"; |
cout<<"3. Print Full Pyramid of Stars\n"; |
cout<<"4. Print Inverted Full Pyramid of Stars\n"; |
cout<<"Enter the Choice: "; |
cout<<"Enter the size"<<endl; |
void invertedHalfPyramid() |
cout<<"Enter the size"<<endl; |
cout<<"Enetr the size"<<endl; |
for(space=1; space<=(size-i); space++) |
void invertedFullPyramid() |
cout<<"Enetr the size"<<endl; |
for(space=1; space<i; space++) |
So this was the program to print the pyramids of different patterns according to the user's choice.
WORKING OF THE PROGRAMM
So here I will discuss the working of the program. It is a program with four functions that print different patterns. The functions are for the purpose that we can use them in the program as many times as we want. The processing of printing takes place in the function instead of the main.
The program starts with the process of execution by adding the libraries in the compiler background. At the start, after adding the library I declared the name of the four functions that are used in the program. So next the compiler will move to the main function. Where firstly I have shown the choice of the pattern type that will be printed on the output screen. After the user enters the choice we will go to the required function, To do so I use the case which will switch the function according to the requirement.
Next, I have made the four functions. if the user enters 1 the first function will execute in which we have printed the half pyramid that is so simple and can be created by two loops one for printing in the row and the other for the column the usage of the loop into the loop is the nested loop. if the user enters the choice of 2 it will create the half pyramid by reversing the pattern on the other side.
Next, the third function is for the full pyramid and the 4th is its inverse. So in this way, the execution of the programs will occur according to the required pattern of the printing pyramid. Option 5 will be four the exit to the code. So that was the working of the whole program that I have written. Now In the next step, I will practically execute the program and its working on the compiler.
Input is the code that I have created and written on the compiler to get the desired working. Here I will show you some screenshots of my input.




The output that I got by executing the program on the compiler is shown below in the screenshot.


So these are the outputs that are the result of the user's choice of 1,2,3 and 4 and if the user will enter 5 as a choice the program will be exited. So this was all from my side about the printing of the pyramids by the stars. I hope that you all will like this post...
Special mentions
@justyy
@steemdoctor1
Regards;
@mateenfatima
Thank you, friend!


I'm @steem.history, who is steem witness.
Thank you for witnessvoting for me.
please click it!
(Go to https://steemit.com/~witnesses and type fbslo at the bottom of the page)
The weight is reduced because of the lack of Voting Power. If you vote for me as a witness, you can get my little vote.
We support quality posts anywhere and any tags.
Curated by : @steemdoctor1