Re: [問題] 九九乘法表的分隔線

看板C_and_CPP (C/C++)作者 (會吐槽的最強)時間14年前 (2011/08/02 22:41), 編輯推噓2(202)
留言4則, 4人參與, 最新討論串2/3 (看更多)
※ 引述《shile775 (笑看人生)》之銘言: [root@localhost c]# cc 99.c && ./a.out |1 2 3 4 5 6 7 8 9 ------------------------------ 1 |1 2 3 4 5 6 7 8 9 2 |2 4 6 8 10 12 14 16 18 3 |3 6 9 12 15 18 21 24 27 4 |4 8 12 16 20 24 28 32 36 5 |5 10 15 20 25 30 35 40 45 6 |6 12 18 24 30 36 42 48 54 7 |7 14 21 28 35 42 49 56 63 8 |8 16 24 32 40 48 56 64 72 9 |9 18 27 36 45 54 63 72 81 [root@localhost c]# #include <stdio.h> #include <stdlib.h> int main(void) { int i,j; for(i = 1; i <= 9; i++) { (i==1)?printf(" |%d",i): printf("%3d",i); } putchar('\n'); while(i>0){ printf("---");i--; } putchar('\n'); for(i = 1; i <= 9; i++) { for(j = 1; j <= 9; j++) { (j==1)?printf("%d |%d",i,i*j): printf("%3d",i*j); } putchar('\n'); } return EXIT_SUCCESS; } -- 3WA訓練家的工作室 宗旨:諸葛單中,謝謝 個人佈弱格 網址:http://3wa.tw -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.240.117.97

08/02 22:44, , 1F
void main
08/02 22:44, 1F

08/02 22:49, , 2F
maybe his compiler is really old XDD
08/02 22:49, 2F
※ 編輯: shadowjohn 來自: 123.240.117.97 (08/02 22:51)

08/02 23:12, , 3F
Linux(gcc4.6.1) && Win7(Turbo c++ 3.0) Orz
08/02 23:12, 3F

08/03 01:01, , 4F
借你的程式練習函式,http://pastie.org/2309975
08/03 01:01, 4F
※ 編輯: shadowjohn 來自: 123.240.117.97 (08/03 08:24)
文章代碼(AID): #1EE0oeAu (C_and_CPP)
文章代碼(AID): #1EE0oeAu (C_and_CPP)