#include<iostream.h>void print(int w){for(int i=1;i<=w;i++) {for (int j=1;j<=i;j++) cout<<i<<" "; cout<<endl; }}void main(){print(5);}
void print( int w )
{
if( w == 1 ) {
cout << w << endl;
}
else {
print( w - 1 );
for( int j = 1; j <= w; j++ )
cout << w << ' ';
cout << endl;
[此贴子已经被作者于2007-11-13 23:24:25编辑过]
void print(int n){ if (n > 0){ print(n-1); for (int i = 0;i < n;++i) cout << n << " "; cout << endl; }}
就是强
void Print(int n,int m){ if(m==0) { return ; } if(n==0) { m--; Print(m,m); cout<<endl;
} else { Print(n-1,m); cout<<m<<" "; }}
谢谢各位高手啦