C++ 程序打印倒置镜像直角三角形星形图案

编写一个 C++ 程序,使用 for 循环打印倒置镜像直角三角形星形图案。

#include<iostream>
using namespace std;

int main()
{
	int i, j, k, rows;
     
    cout << "Enter Inverted Mirrored Right Triangle Star Rows = ";
    cin >> rows;

    cout << "Inverted Mirrored Right Angled Triangle Star Pattern\n"; 

    for(i = rows; i > 0; i--)
    {
    	for(j = rows - i; j > 0; j--)
		{
            cout << " ";
        }
        for(k = 0; k < i; k++)
		{
            cout << "*";
        }
        cout << "\n";
    }		
 	return 0;
}
CPP Program to Print Inverted Mirrored Right Triangle Star Pattern

这个C++ 示例使用 while 循环打印给定字符的镜像倒置直角三角形。

#include<iostream>
using namespace std;

int main()
{
	int i, j, k, rows;
    char ch;
     
    cout << "Enter Inverted Mirrored Right Triangle Star Rows = ";
    cin >> rows;

    cout << "Enter Symbol for Inverted Mirrored Right Triangle = ";
    cin >> ch;

    cout << "Inverted Mirrored Right Angled Triangle Star Pattern\n"; 
    i = rows;
    while( i > 0)
    {
        j = rows - i;
    	while( j > 0)
		{
            cout << " ";
            j--;
        }
        k = 0;
        while( k < i)
		{
            cout << ch;
            k++;
        }
        cout << "\n";
        i--;
    }		
 	return 0;
}
Enter Inverted Mirrored Right Triangle Star Rows = 15
Enter Symbol for Inverted Mirrored Right Triangle = $
Inverted Mirrored Right Angled Triangle Star Pattern
$$$$$$$$$$$$$$$
 $$$$$$$$$$$$$$
  $$$$$$$$$$$$$
   $$$$$$$$$$$$
    $$$$$$$$$$$
     $$$$$$$$$$
      $$$$$$$$$
       $$$$$$$$
        $$$$$$$
         $$$$$$
          $$$$$
           $$$$
            $$$
             $$
              $