#include <iostream>
using namespace std;
void num7()
{
int numRows;
cin >> numRows;
for (int x = 0; x < numRows/2; x++) {
for (int y = 0; y <= x; y++) {
cout << "*";
}
cout << "\n";
}
float numRowsfloat = numRows;
double cos = numRowsfloat / 2;
int tan = numRowsfloat / 2;
double sin = tan;
if (cos == sin)
cout << "\n";
for (int x = 0; x < numRows/2; x++) {
for (int y = numRows/2; y >0; y--) {
cout << "*";
}
}
else
for (int x = 0; x < numRows/2+1; x++) {
for (int y = x; y >0; y--) {
cout << "*";
}
cout << "\n";
}
}
在 else 列中,它表示预期的表达式。这是试图制作一个三角形。喜欢
*
**
***
***
**
*
对于输入的 6 或
*
**
***
**
*
对于输入 5