0

Hello!

I muss create a diamond shape, with 4 (triangles). The first 2 i was able to make it, but 2 others not. So i need some beginners help.

//*
//**
//***
//****
//*****
    for (int i=0;i<value-1;i++)        
    {
     for (int j=0;j<=i;j++)
     {
          cout<<"*"; 
          }   
     
     cout<<endl;
     }
     
for(int a=0; a<value; a++)
{
        for(int b=a; b<value; b++)
        {
                cout<<"*";
                }
                cout<<endl;
                }

//*****
//****
//***
//**
//*
3
Contributors
2
Replies
4
Views
8 Years
Discussion Span
Last Post by Lerner
0

Be more specific please. I have a vague idea of what you're asking only because I've answered the diamond question several hundred times already.

0

Please put your code snippets into a program, compile and run. I think you'll find that your code doesn't generate the pictures that you want.

Do you realize you can make a diamond picture with 2 triangles instead of 4? Conceptually it seems easier to do with 2 than with 4. But if the requirement is 4, then so be it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.