1069745273


私信TA

用户名:1069745273

访问量:5738

签 名:

Just do IT.

等  级
排  名 262
经  验 5780
参赛次数 3
文章发表 166
年  龄 0
在职情况 待业
学  校
专  业 计算机科学与技术

  自我简介:

C++处理字符串真方便

#include <bits/stdc++.h>
using namespace std;

void print(int &n){
    string border = "*";
    string bottom(n+2,'*');
    string empty(n,' ');
    for(int i=0;i<=n;i++){
        if(i!=n){
            cout << border + empty + border << endl;
        }
        else{
            cout << bottom << endl << endl;;
        }
    }
}

int main(){
    int n;
    while(cin>>n){
        print(n);
    }
    return 0;
}


 

0.0分

0 人评分

  评论区