C++生成奇数行蝴蝶结图案 - 代码示例与解释
#include "iostream"\nusing namespace std;
int main() {
int n;
cin >> n;
if (n % 2 != 0) {
for (int i = 0; i < n/2 + 1; i++) {
for (int j = 0; j < n - i; j++) {
cout << "";
}
cout << endl;
}
for (int i = n/2 - 1; i >= 0; i--) {
for (int j = 0; j < n - i; j++) {
cout << "";
}
cout << endl;
}
}
return 0;
}
原文地址: http://www.cveoy.top/t/topic/qsA1 著作权归作者所有。请勿转载和采集!