經典C程序100例==61,第1張

經典C程序100例==61,第2張

【程序61】
標題:打印出楊煇三角形(如下圖需要10行)
1。程序分析:
1 1
1 2 1
1 3 3 1
1 6 4 1
1 5 10 10 5 1
2。程序源代碼:
main()
{int i,j;
int a[10][10];
printf(" \ n");
for(I = 0;I { a[I][0]= 1;
a[I][I]= 1;}
for(I = 2;I for(j = 1;j a[I][j]= a[I-1][j-1] a[I-1][j];
for(I = 0;I { for(j = 0;j printf("]",a[I][j]);
printf(" \ n");
}
}
[程序62]
主題:學習putpixel畫點。
1。程序分析:
2。程序源代碼:
# include" stdio . h"
# include" graphics . h"
main()
{[/br/
init graph(& driver,&mode,"");
setbkcolor(黃色);
for(I = 50;I for(j = 50;j putpixel(i,j,1);
for(j = 50;j for(I = 50;我putpixel(i,j,1);
}

位律師廻複

生活常識_百科知識_各類知識大全»經典C程序100例==61

0條評論

    發表評論

    提供最優質的資源集郃

    立即查看了解詳情