Pattern printing is to arrange the symbols.
In this program,I arranged the asterix symbol in the shape of Q.
Like the below,
********
* *
* *
* *
* * *
* **
********
*
Program:
#include<iostream>
using namespace std;
int main()
{
int i;
for(i=0;i<=7;i++)
{
switch(i)
{
int main()
{
int i;
for(i=0;i<=7;i++)
{
switch(i)
{
case 1:cout<<"******"<<endl; break;
case 2:cout<<"* *"<<endl;break;case 3:cout<<"* *"<<endl;break;
case 4:cout<<"* * *"<<endl;break;
case 5:cout<<"* **"<<endl;break;
case 6:cout<<"******"<<endl;break;
case 7:cout<<" *"<<endl;break;
}
}
}


No comments:
Post a Comment