write a program in c++ to generate imp

z y x w v w x y z
z y x w x y z
z y x y z
z y z
z

Answer Posted / prasenjit roy

#include <iostream>
using namespace std;

#define START 'z'
#define END 'v'
#define LIMIT ( START - END + 1 )

int main(int argc, char* argv[])
{
int i,j;

for( i=0; i<LIMIT; i++){
char ch = START+1;

for( j=0; j<LIMIT; j++)
if( j>=i )
cout<<--ch<<" ";
else
cout<<" ";


for( j=LIMIT-1; j>i ; j--)
cout<<++ch<<" ";

cout<< endl;
}

return 0;
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a container class? What are the types of container classes in c++?

876


Do you know what are pure virtual functions?

852


What are arithmetic operators?

746


When is dynamic checking necessary?

796


How long will it take to learn programming?

790


What is heap sort in c++?

845


Explain data encapsulation?

868


What is the disadvantage of using a macro?

800


What data encapsulation is in c++?

774


Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

2291


What is the full form of c++?

885


Can you pass a vector to a function?

731


What is using namespace std in c++?

793


What is #include iostream h in c++?

839


Write a Program to find the largest of 4 no using macros.

813