Creating an Equilateral Star Triangle in C++

BOOKC, this time share about Creating an Equilateral Star Triangle in C++

BOOKC this time will post a source code that can display an equilateral star triangle using the C++ programming language.

here is the source code

using namespace std;
int main ()
 int line, space, star, a;
 cout << " high input ";
 cin >> a;
 for (row=1; row<=a; row++)
  for (space=1; space<=a-line; space++)
   cout<<" ";
  for (star=1; star<=row; star++)
   cout<<"* ";
 return 0;

From the results of the runing, it can be seen that when we input the height of the triangle 10 it will display a triangle of 10 levels.

So a little knowledge from bookc blog may be useful.


Hopefully the information we provide can be useful.

Press ESC to close