Hello!
I am having a problem with my program.I have made a program that prints the four different shapes one after the other. But the program should print these four different shapes side by side.
I know there should be one outer loop for this but I am unable to change the program. Can any one help? I am really in need of it....

#include<iostream.h>
#include<conio.h>
void main()
    {
    int i, j, k;
    cout<<"\ta\n"<<endl;
    for(i=1;i<=10;i++)
        {
        for(j=1;j<=i;j++)
        cout<<"*";
        cout<<endl;
        }
        cout<<endl<<endl<<"\tb\n"<<endl;
    for(i=10;i>=1;i--)
        {
        for(j=1;j<=i;j++)
        cout<<"*";
        cout<<endl;
        }
        cout<<endl<<endl<<"\tc\n"<<endl;
    for(i=10;i>=1;i--)
        {
        for(k=1;k<=10-i;k++)
        cout<<" ";
        for(j=1;j<=i;j++)
        cout<<"*";
        cout<<endl;
        }
        cout<<endl<<endl<<"\td\n"<<endl;
        for(i=1;i<=10;i++)
        {
        for(k=1;k<=10-i;k++)
        cout<<" ";
        for(j=1;j<=i;j++)
        cout<<"*";
        cout<<endl;
        }
    getch();
    }

If you print them side by side then it would make a blank diamond
shape in the middle. So instead of creating different shape 1 by one,
try to think about the whole shape as one. In fact, draw it on a piece
of paper, and try to think of some logic.

1) How many spaces does the first row have?
2) What is the rate of increase in spaces and stars?
3) How is it mirrored?

the great,
study this thread -
void main vs int main

>I am unable to change the program. Can any one help? I am really in need of it....
Use two dim. character array and put asterisks '*' and spaces.

Yes, this is prettymuch the best way to do it, However if you could use the string library i guess it would be pretty easy with the use of + Operator.

This question has already been answered. Start a new discussion instead.