1 #include<iostream> 2 #include<iomanip> 3 #include<cstdio> 4 #include<cstdlib> 5 #include<cstring> 6 #include<cmath> 7 #include<string> 8 #include<algorithm> 9 #include<vector> 10 #include<map> 11 #include<stack> 12 #include<queue> 13 #include<deque> 14 #include<set> 15 #include<cctype> 16 #define LL long long 17 #define maxn (int)1e5 18 #define INF 0x3f3f3f3f 19 using namespace std; 20 int main() 21 { 22 ios::sync_with_stdio(false); 23 cin.tie(0); 24 cout.tie(0); 25 #ifndef ONLINE_JUDGE 26 freopen("input.txt","r",stdin); 27 #endif 28 int T; 29 int n,m; 30 while(cin>>n>>m) 31 { 32 for(int i=1;i<=m+2;++i) 33 { 34 for(int j=1;j<=n+2;++j) 35 { 36 if((i==1||i==m+2)&&(j==1||j==n+2)) cout<<‘+‘; 37 else if(i==1||i==m+2) cout<<‘-‘; 38 else if(j==1||j==n+2) {cout<<‘|‘;} 39 else cout<<" "; 40 } 41 cout<<endl; 42 } 43 } 44 45 46 }
原文:https://www.cnblogs.com/Auroras/p/11188091.html