forked from durgesh2001/hacktoberfest_demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmario.cpp
More file actions
36 lines (35 loc) · 836 Bytes
/
mario.cpp
File metadata and controls
36 lines (35 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include<conio.h>
using namespace std;
int main(void)
{
int height;
//Gets height of pyramid from User
do
{
cout<<"enter the height between 1 and 8: ";
cin>>height;
}
while (!(height >= 1 && height <= 8));
for (int i = 0; i < height; i++)
{
for (int space1 = height; space1 > i + 1; space1--)
{
cout<<" "; // print right spaces pyramid
}
for (int j = 0; j <= i; j++)
{
cout<<"#"; //print left hashes(#) pyramid
}
for (int space2 = 0; space2 < 2; space2++)
{
cout<<" "; //prints spaces between pyramid
}
for (int l = 0; l <= i; l++)
{
cout<<"#"; //prints right hashes(#) pyramid
}
printf("\n");
}
getch();
}