赞
踩
- |---|
- |xxx|
- |---|
- |xxx|
- |---|
5
- |---|
- |xxx|
- |---|
- |xxx|
- |---|
7
- |-----|
- |xxxxx|
- |xxxxx|
- |-----|
- |xxxxx|
- |xxxxx|
- |-----|
解析:详见代码:
- #include <iostream>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- for (int i = 0; i < n; ++i) {
- for (int j = 0; j < n; ++j) {
- char ch;
- if (j == 0 || j == n - 1) {
- ch = '|';
- } else if (i == 0 || i == n - 1 || i == n / 2) {
- ch = '-';
- } else {
- ch = 'x';
- }
- cout << ch;
- }
- cout << endl;
- }
- return 0;
- }

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。