write a c++ program to impliment a class named display. the class should contain a function member to output the following. (use a for loop structure)
3
6 6
9 9 9

Recommended Answers

All 4 Replies

for (int i = 0; i<1; ++i)
{
  cout << "3" << endl << "6 6" << endl << "9 9 9" << endl;
}
commented: Deep insights :) +15
#include<iostream.h>
void main()
{
 int x=3;
 for(int i=1;i<=3;i++)
  {
   for(int j=1;j<=i;j++)
    cout<<x<<" ";
   x=x+3;
   cout<<endl; 
  }
} 

Fully tested. Hope you like it :D .

please don't supply the answer until you realise that the op tried a lot to solve the question. in this case you're doing his homework which is against daniweb rules.

i would have been given you a downvote if you weren't newbie.but read the community rules.

you can still edit your post.

I didnt read the rules . Sorry . Ill improve my replies.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.