Arrow Downward
arrowDownward() draws an arrow in the downward direction and it takes 2 parameters:
noOfLines takes the number of lines.
ch takes the character to be displayed in the arrow in downward direction.
Code
#include "stdafx.h"
#include "iostream"
#include "conio.h"
#include "iomanip"
using namespace std;
void arrowDownward(int noOfLines,char ch)
{
for(int i=0;i<noOfLines+3;i++)
{
for(int j=1;j<=noOfLines;j++)
{
if(j==noOfLines)
cout<<ch<<endl;
else
cout<<" ";
}
}
for(int l=0;l<noOfLines*2;l=l+2)
{
for(int m=0;m<l;m=m+2)
cout<<" ";
for(int n=0;n<(noOfLines*2)-l-1;n=n+1)
cout<<ch;
cout<<endl;
}
}
int main()
{
arrowDownward(12,'*');cout<<endl;
_getche();
return 0;
}
Output
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
***********************
*********************
*******************
*****************
***************
*************
***********
*********
*******
*****
***
*
0 comments:
Post a Comment