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;
                }

//*****
//****
//***
//**
//*

Recommended Answers

All 2 Replies

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.

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.

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.