#include<iostream.h>

//#include <stdio.h>

void main()
{

    int n=5,i,j;
     int a[N+1][2*N+4];
    


    
    //初始化数组;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=2*n+2;j++)
        {
            a[i][j]=0;
        }
    }
    
    a[1][6]=1;

    //设置杨辉三角的数值;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=2*n;j++)
        {
            if(a[i][j]!=0)
            {
                a[i+1][j-1]=a[i][j-2]+a[i][j];
                a[i+1][j+1]=a[i][j+2]+a[i][j];
            }
        }
    }
    
    //打印杨辉三角;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<2*n;j++)
        {

            if(a[i][j]!=0)
            {
                cout<<"   "<<a[i][j];   //打印格式自设,如加“\t”或空格等;
            }                            
            else
            {
                cout<<"   ";
            }
            if(j==(2*n-1))
            {
                cout<<endl;
            }
        }
    }
}
最后  出现的 少了个 1    只有 如下 数字
                       1
                   1      1
                1      2       1
            1      3        3      1
           1       4      6     4