From 994469e68e344792bec95ed972398ac4ed5dff3e Mon Sep 17 00:00:00 2001 From: Aman1124 <43760029+Aman1124@users.noreply.github.com> Date: Fri, 5 Oct 2018 17:58:54 +0530 Subject: [PATCH] Add files via upload --- Program.cpp | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Program.cpp diff --git a/Program.cpp b/Program.cpp new file mode 100644 index 0000000..8fd6bc2 --- /dev/null +++ b/Program.cpp @@ -0,0 +1,67 @@ +#include +using namespace std; +int main() +{ +int a,x; +cout<<"Welcome\n"; +Start: +cout<<"Choose any one of the following:\n"; +cout<<"1.Pattern 1\n2.Pattern 2\n"; +cin>>a; +switch (a) +{ +case 1: +{ +for(x=1;x<=5;x++) +{ +for(int x1=5;x1>x;x1--) +cout<<" "; +cout<<"*"; +for(int x1=1;x1<=2*(x-1)-1;x1++) +cout<<" "; +if(x!=1) +cout<<"*"; +cout<<"\n"; +} +for(int x=4;x>=1;x--) +{ +for(int x1=5;x1>x;x1--) +cout<<" "; +cout<<"*"; +for(int x1=1;x1<=2*(x-1)-1;x1++) +cout<<" "; +if(x!=1) +cout<<"*"; +cout<<"\n"; +} +break; +} +case 2: +{ +for(x=1;x<=5;x++) +{ +for(int x2=5;x2>x;x2--) +cout<<" "; +for(int y=1;y<=2*x-1;y++) +cout<<"*"; +cout<<"\n"; +} +for(x=4;x>=1;x--) +{ +for(int x2=4;x2>=x;x2--) +cout<<" "; +for(int y=1;y<=2*x-1;y++) +cout<<"*"; +cout<<"\n"; +} +break; +} +default: +{ +cout<<"Wrong choice\n"; +goto Start; +break; +} +} +return 0; +}