Of course I could...
As rocketboy9000 said, fully optimizing my program would lead to his program (i.e. only one cout statement).
But I wanted to help the OP. If he reads what I wrote carefully he will be able to figure it out. I even used helpful struct names. What I wrote is not an obfuscated program, it's just a bloated program. I essentially handed him the solution... (but I didn't want to do this literally, because then I'd have to listen to you lecturing me about it...)
So this what i get from this thread..... A title that the " One who makes others do his homework " ehhhh......
Homework lasts for 5 days in any institute ??
i'm telling that i'm not getting the approach to do this program and u guys are saying that i'm not even trying . Trying doesn't mean i will try in this site only. I hav tried in my PC. Asked my friends, teachers for a logic to solve this all this 5 days only to solve this problem and u r saying am not trying :-( :-(....
Sure, but that isn't the way learning works. You learn from mistakes, if you give us a code in which you try to solve the problem, we can analyze the mistakes (Why did he try it this way? What would be a better way?) and can help you a bit. If we throw complete working codes at you after which you try to understand them, that brings both of us nothing:
You don't learn anything.
We wasted our time because of the fact that you didn't learn anything.
Actually homework can last that long if you're in a school.. But that's not the point.
Anyway, I'll try to be more helpful this time.
You see, since you haven't posted any code, I can't know what is causing problems here. So I have to ask:
Are you able to print a line of x symbols? If no, see a tutorial about for loops.
Are you able to print a rectangle? If no, put the previous question code into a for loop.
Are you able to print a left sided triangle? If no, notice that in a triangle every line is shorter by 1. You can have a for(int i = 5; i > 0; i--) loop where i decreases by 1 too. Then you just have to use the code of question 1, where x = i.
To print a right sided triangle, you first have to print n gaps and then m symbols. m+n = width. n increases by one. so have a for loop, where variable 'i' increases by one too. then draw a ' ' i times and '1' width-i times.
I apologize for my behavior , but finally am able to solved my own doubt. Thanks for evryones involvement. And i apologize once again to all..... SORRY !!