此题是一道简单的画图题!!只要掌握规律还是很容易的!呵呵!!

首先注意输入的是 长n 高m,还有就是注意‘+“号就行了!

 

 

#include<iostream>
using namespace std;
int main()
{
 int n,m,i,j;
 while(cin>>n>>m)
 {
  for(i=0;i<m+2;i++)
  {     for(j=0;j<n+2;j++)
   {
    if(i==0&&j==0||i==0&&j==n+1||i==m+1&&j==0||i==m+1&&j==n+1)
     cout<<'+';
     else
     if(i==0||i==m+1)
      cout<<'-';
       else
        if(j==0||j==n+1)
         cout<<'|';
        else
         cout<<' ';}
  cout<<endl;}
   
   cout<<endl;
 }
 return 0;
}
  

相关文章:

  • 2021-06-01
  • 2021-07-23
  • 2021-10-24
  • 2021-04-11
  • 2021-04-06
  • 2021-04-17
  • 2021-11-16
  • 2021-08-08
猜你喜欢
  • 2021-06-10
  • 2022-12-23
  • 2021-08-04
  • 2021-08-16
  • 2021-04-16
  • 2021-04-26
  • 2021-06-26
相关资源
相似解决方案