[IMG]http://img.villagephotos.com/p/2004-8/807060/resultwanted.JPG[/IMG]

the picture shows the result i wanna achieve but my program here which i modified:

#include <iostream>
using namespace std;
int main()
{
  int k, m;
  for(k = 1; k <= 10; k++)
  {

   for(m = 0; m < k; m++)
      cout << "*";

   cout << endl;
  }
  cin.get();  
  return 0;
} ( copyrights JASWEB)

I AM ONLY ABLE TO ALIGN THE TRIANGLES VERTICALLY AND NOT HORIZONTALLY :confused: ----->AS IN THE PHOTO

my result is SOME WHAT like this :o

****
***
**
*

*
**
***
****

****
***
**
*

dear use function

gotoxy(rows,cols); cout<<"*";

it will display the next character on the screen on a given location
use rows, and cols loop and passed here.
Enjoy this trick, I am attending my lecture in university therefore i cannot write code for you at this time.
Bye! :lol:

>dear use function
Dear, don't suggest nonportable functions unless you know that they're supported and acceptable solutions.

>I AM ONLY ABLE TO ALIGN THE TRIANGLES VERTICALLY AND NOT HORIZONTALLY
For each row, handle all of the triangles rather than just one:

#include <iostream>

using namespace std;

int main()
{
  for ( int r = 0; r < 10; r++ ) {
    // Ascending
    for ( int i = 0; i < 10; i++ )
      cout.put ( i <= r ? '*' : ' ' );

    cout.put ( ' ' );

    // Descending
    for ( int i = 9; i >= 0; i-- )
      cout.put ( i >= r ? '*' : ' ' );

    cout<<endl;
  }
}
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.