C++输出金字塔

#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
 for(int n=1;n<8;n++)
 cout<<setw(20-n)<<setfill(' ')<<" "       //nm
     <<setw(2*n-1)<<setfill('B')<<"B"<<endl;
 return 0;
}

C++输出金字塔_第1张图片
 

你可能感兴趣的:(C++输出金字塔)