Wednesday, 28 January 2015

Print A with Logical Code in C++

Structure of the Problem Requirements 

This Program is substantially added to understanding of logic building and improved programming skills. 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 it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

1 comments: Post Yours! Read Comment Policy!▼
Important Note:
We have Zero Tolerance to Spam. Chessy Comments and Comments with Links will be deleted immediately upon our review.