我现在脑震荡,所以我想问一个非常简单的问题。
目前,我正在尝试打印出这样的开始
当输入为 7 时,输出为
*
**
*
**
*
**
*
这里我的代码是,它打印 14 次而不是 7 次,或者当我放N/2
它时不打印奇数。
#include <iostream>
using namespace std;
int main () {
int N;
cout << " Please enter N " ;
cin >> N;
for (int i = 0; i < N ; i++) {
cout << "*" << endl;
for (int j = 0; j < 2; j++) {
cout << "*" ;
}
cout << endl;
}
}