Metal Steak

Hard to eat

  C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  0 Posts :: 79 Stories :: 0 Comments :: 0 Trackbacks

公告

aaaaaaaaaaaa

常用链接

留言簿(1)

我参与的团队

搜索

  •  

最新评论

#include <iostream>
#include 
<iomanip>
using namespace std;

int main()
{
    
void matrixprinter(int a[][50],int);
    
int a[50][50],i=0,j=0,n;
    memset(a,
0,sizeof(a));
    cin
>>n;
   
    
for(;i<=n;i++)
        
for(int k=0;k<=i;k++)
            a[i
-k][j+k]=i;

    
for(;j<=n;j++)
        
for(int k=0;k<=n-j;k++)
            a[i
-k][j+k]=j;
   
    matrixprinter(a,n);

    
return 0;
}

void matrixprinter(int a[][50],int n)
{
    
for(int p=0;p<n;p++)
    {
        
for(int q=0;q<n+1;q++)
            cout
<<setw(5)<<a[p][q];
        cout
<<endl;
    }             
}

posted on 2009-09-15 21:55 mad4alcohol 阅读(150) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航:   博客园   博客园最新博文   博问   管理