C++ Program to print Hexagonal Shape

#include<iostream.h>
#include<conio.h>
void main()
{   int d=0,b=0;
clrscr();
for(int i=9;i<=19;i++){
gotoxy(i,12);
cout<<char(2);
}
for(int j=9;j<=19;j++){
gotoxy(j,26);
cout<<char(2);
}
d=9;
for( b=8;b<=14;b++){
d=d-1;
gotoxy(d,b+5);
cout<<char(2);
} d=19;
for( b=18;b<=24;b++){
d=d+1;
gotoxy(d,b-5);
cout<<char(2);
} d=9;
for( b=20;b>=14;b--){
d=d-1;
gotoxy(d,b+5);
cout<<char(2);
}d=27;
for( b=14;b<=20;b++){
d=d-1;
gotoxy(d,b+5);
cout<<char(2);
}
cout<<"\n\n\n\n Who's it is :) . . . .";
getch();}


0 comments:

Post a Comment

My Instagram