How to Draw an Arrow with Asterisk in C++

This is the cool and logic building C++ program for beginners. The purpose of this C++ code is to understand the different programming terms in different ways. The program will generate an arrow at the end of executing.

Source Code 

#include <iostream>
#include <unistd.h>
using namespace std;
void welcomeScrean(void);
void sleep();
void draw();
int main()
{
system ("color F0");

welcomeScrean();
draw();
return 0;

}

void welcomeScrean(void){
cout<<"\a"
<<"\t*******************************************************"<<endl
<<"\t*******************************************************"<<endl
<<"\t** Welcome To **"<<endl
<<"\t** Draw By * **"<<endl
<<"\t** Program **"<<endl
<<"\t*******************************************************"<<endl
<<"\t*******************************************************"<<endl
<<endl
<<endl;
sleep();

}
void sleep(){
sleep(1);
for (int i=0 ; i<3;i++)
{
if (i==0)
{
cout<<"\tJust a min ";
}//END IF i
cout<<"\a.";
sleep(2);
}//
}
void draw(){
int size,i,j,k,k1,p;
cout<<"\n\n\tEnter A No : ";
cin>>size;
cout<<"\n\n\t";
for (i=0;i<size;i++)
{
k = size-i;
for (j=0;j<k;j++)
{
cout<<" ";
}
for (j=k;j<size;j++)
{
cout<<"*";
}
cout<<"I";

for (j=k;j<size;j++)
{
cout<<"*";
}
cout<<"\n\t";
}
k = size / 2;
k1 = k / 2;
p = size-k1;
for (i=0;i<k;i++)
{
for(j=0;j<p;j++)
{
cout<<" ";
}
for(j=0;j<k1;j++)
{
cout<<"*";
}
cout<<"I";
for(j=0;j<k1;j++)
{
cout<<"*";
}
cout<<"\n\t";
}
}

Output of the Program

Draw an Arrow with Astaric * in C++

Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment