Print A with Logical Code in C++

This Program is substantially added to understand the programming logic. The purpose of this piece of code is to learn logic building . Instead of going with hard coding just try to do it with little bit change in logic. With this logic the program will display the alphabet A.

Source Code

#include <iostream>
#include <iomanip>
using namespace std;
void display_A();
int main() {
 cout<<"\t \t \t LEP Tutorials \n \n \n";
 display_A();
 return 0;
}
void display_A(){
int j=1;
 for(int i=13;i>0;i--){
  if(i==6){
   j++;
   cout<< setw(i-1)<<"";
   for(int k=0;k<j;k++){
    cout<<"*";
   }
   cout<<"\n";
   j++;
  }else{
   j++;
   cout<< setw(i)<<"*"<<setw(j)<<"*\n";
   j++;
  }
 } 
}

Output of the Program

Print A with Logical Code 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