-5
#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列中,它表示期望的表達式。 這是試圖使三角形形狀。像在C++中的預期表達式?
*
**
***
***
**
*
爲inputed 6 或
*
**
***
**
*
爲inputed 5
將條件語句的開始和結束括號放在一起並再次編譯您的代碼。 – mumair 2013-02-23 06:31:25