标签:page space otto ble bottom style pre bit top
根据参数,画出矩形。
7 7 @ 0
@@@@@@@ @ @ @ @ @ @ @ @ @ @ @@@@@@@
法一
#include<iostream> #include<cstdio> #include<cstdlib> using namespace std; int main() { int a,b; char ch; bool c; cin>>a>>b>>ch>>c; if(c==1) { for(int i=1;i<=a;i++) { for(int j=1;j<=b;j++) cout<<ch; cout<<endl; } } else { for(int i=1;i<=a;i++) cout<<ch; cout<<endl; for(int i=2;i<a;i++) { for(int j=1;j<=b;j++) { if(j==1||j==b) cout<<ch; else cout<<" "; } cout<<endl; } for(int i=1;i<=a;i++) cout<<ch; } return 0; }
#include<bits/stdc++.h> using namespace std; int m,n,q; char fil,wai; int main() { cin>>m>>n>>wai>>q; if(q==0) fil=‘ ‘; if(q==1) fil=wai; for(int i=1;i<=m;i++) { for(int j=1;j<=n;j++) { if(i==1||i==m||j==1||j==n) cout<<wai; else cout<<fil; } cout<<endl; } return 0; }
标签:page space otto ble bottom style pre bit top
原文地址:http://www.cnblogs.com/z360/p/6260409.html