C++ Program to Print an Alphabet from A to L of *’s in Capital Letter

C++ Program to Print an Alphabate from A to L of Asterisk in Capital Letter

#include<iostream>

using namespace std;

int main()
{
int i,j,k=1;
char ch;
cout<<“Input an Alphabet in capital letters that you want to print:”;
cin>>ch;
cout<<“nnnn”;
switch(ch)
{
case ‘A’:
cout<<“ttt    “;
for(i=1;i<=40;++i)
{
for(j=0;j<=22;++j)
{
if(i==1||i==2||i==21||i==20)
cout<<“*”;
else
{
if(j==0||j==20)
cout<<“**”;
else
cout<<” “;
}
}
cout<<“nttt    “;

}
break;

case ‘B’:
cout<<“tttt”;

while(k<=2)
{
for(i=1;i<=9;++i)
{
for(j=0;j<=i;++j)
{
if(j==0||j==i)
cout<<“**”;
else
cout<<” “;
}

cout<<“ntttt”;

}
for(i=1;i<=10;++i)
{
if(i==1||i==10)
cout<<“**”;
else
cout<<” “;
}
cout<<“ntttt”;

for(i=1;i<=10;++i)
{
if(i==1||i==10)
cout<<“**”;
else
cout<<” “;
}
cout<<“ntttt”;

for(i=9;i>=1;–i)
{
for(j=0;j<=i;++j)
{
if(j==0||j==i)
cout<<“**”;
else
cout<<” “;
}
cout<<“ntttt”;
}
++k;
}
break;

case’C’:
cout<<“ttt    “;

for(i=1;i<=40;++i)
{
for(j=0;j<=22;++j)
{
if(i==1||i==2||i==39||i==40)
cout<<“*”;
else
{
if(j==0)
cout<<“**”;
else
cout<<” “;
}
}
cout<<“nttt    “;

}
break;

case’D’:
cout<<“tttt”;
for(i=1;i<=18;++i)
{
for(j=0;j<=i;++j)
{
if(j==0||j==i)
cout<<“**”;
else
cout<<” “;
}
cout<<“ntttt”;
}
while(k<=4)
{
for(i=1;i<=19;++i)
{
if(i==1||i==19)
cout<<“**”;
else
cout<<” “;
}
cout<<“ntttt”;
++k;
}
for(i=18;i>=1;–i)
{
for(j=0;j<=i;++j)
{
if(j==0||j==i)
cout<<“**”;
else
cout<<” “;
}
cout<<“ntttt”;
}
break;

case’E’:

cout<<“tttt”;
for(i=1;i<=39;++i)
{
for(j=1;j<=20;++j)
{
if(i==1||i==2||i==20||i==21||i==38||i==39)
cout<<“*”;
else
{
if(j==1)
cout<<“**”;
else
cout<<” “;
}
}
cout<<“ntttt”;
}
break;

case’F’:

cout<<“tttt”;

for(i=1;i<=40;++i)
{
for(j=1;j<=20;++j)
{
if(i==1||i==2||i==18||i==19)
cout<<“*”;
else
{
if(j==1)
cout<<“**”;
else
cout<<” “;
}
}
cout<<“ntttt”;
}
break;

case’G’:

cout<<“ttt”;
for(i=1;i<=25;++i)
{
for(j=1;j<=20;++j)
{
if(i==1||i==2)
cout<<“*”;
else
{
if(j==1)
cout<<“**”;
else
cout<<” “;
}
}
cout<<“nttt”;
}
for(i=1;i<=10;++i)
{
for(j=1;j<=20;++j)
{
if(i==1||i==2)
{ if(j==1||j==14||j==15||j==16)
cout<<“**”;
else
cout<<” “;
}
else
{
if(i==9||i==10)
cout<<“*”;
else
{  if(j==1||j==18)
cout<<“**”;
else
cout<<” “;
}
}
}
cout<<“nttt”;
}
break;

case’H’:

cout<<“ttt”;
for(i=1;i<=40;++i)
{
for(j=1;j<=21;++j)
{
if(i==20||i==21)
cout<<“*”;
else
{
if(j==1||j==19)
cout<<“**”;
else
cout<<” “;
}
}
cout<<“nttt”;
}
break;

case’I’:

cout<<“ttt”;
for(i=1;i<=40;++i)
{
for(j=1;j<=30;++j)
{
if(i==1||i==2||i==39||i==40)
cout<<“*”;
else
{
if(j==15)
cout<<“**”;
else
cout<<” “;
}
}
cout<<“nttt”;
}
break;

case’J’:
cout<<“ttt”;

for(i=1;i<=30;++i)
{
for(j=1;j<=28;++j)
{
if(i==1||i==2)
cout<<“*”;
else
{
if(j==14)
cout<<“**”;
else
cout<<” “;
}
}
cout<<“nttt”;
}
for(i=1;i<=10;++i)
{
for(j=1;j<=15;++j)
{
if(i==10||i==9)
cout<<“*”;
else
{
if(j==1||j==13)
cout<<“**”;
else
cout<<” “;
}
}
cout<<“nttt”;
}
break;

case’K’:

cout<<“ttt”;
for(i=20;i>=1;–i)
{
for(j=0;j<=i;++j)
{
if(j==0||j==i)
cout<<“**”;
else
cout<<” “;
}
cout<<“nttt”;
}

for(i=1;i<=20;++i)
{
for(j=0;j<=i;++j)
{
if(j==0||j==i)
cout<<“**”;
else
cout<<” “;
}
cout<<“nttt”;
}
break;

case’L’:

cout<<“ttt”;
for(i=1;i<=40;++i)
{
for(j=1;j<=25;++j)
{
if(i==39||i==40)
cout<<“*”;
else
{
if(j==1)
cout<<“**”;
else
cout<<” “;
}
}
cout<<“nttt”;
}
break;
}

return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *