一道C++题

来源:互联网 发布:android应用 性能优化 编辑:程序博客网 时间:2024/06/07 19:57

/*

打印出下面的图形:

    1

  121

12321

...

 

 

*/ 

#include <iostream>using namespace std;int main(){const int row = 8; //行数 for(int m = 1;m <= row;m++){int n = 1;for(int i = row - m;i > 0;i --){cout << " ";}for(n;n <= m;n ++){cout << n;}for(int n2 = m - 1;n2 >= 1;n2--){cout <<n2;}cout <<endl;}return 0;}

原创粉丝点击