當前位置:編程學習大全網 - 電腦編程 - 如何用C語言畫壹個“聖誕樹”

如何用C語言畫壹個“聖誕樹”

#include <stdio.h>

#include <stdlib.h>

int main(int argc, char* argv[])?

{

int j,s;

int k,x;

int y;

int n = argc > 1 ? atoi(argv[1]) : 4;

for ( j = 1; j <= n; j++) {

?s = 1 << j, k = (1 << n) - s, x;

for ( y = s - j; y >= 0; y--, putchar('\n')) {

for (x = 0; x < y + k; x++) printf(" ?");

for (x = 0; x + y < s; x++) printf("%c ", '!' ^ y & x);

for (x = 1; x + y < s; x++) printf("%c ", '!' ^ y & (s - y - x - 1));

}

}

}

  • 上一篇:C語言問題,求值。
  • 下一篇:在plc梯形圖中,輸出繼電器可以並聯,但不能串聯。
  • copyright 2024編程學習大全網