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 virtual function? Explain with an example

591


How to declare a function pointer?

579


What is enum class in c++?

710


Which programming language's unsatisfactory performance led to the discovery of c++?

810


describe private access specifiers?

645






an integer constant must have atleast one a) character b) digit c) decimal point

556


Explain what is class definition in c++ ?

599


What is an iterator class in c++?

601


What do you mean by late binding?

621


Explain the purpose of the keyword volatile.

638


What can c++ be used for?

585


How the endl and setw manipulator works?

560


What is recursion?

661


What is a storage class?

645


Write an algorithm that determines whether or not an almost complete binary tree is a heap.

3431