突发奇想,本人新手小白。请问这样的代码有吗
1
Volio 2015-11-11 15:18:29 +08:00 via Android
printf("Hello world!");
|
2
aheadlead 2015-11-11 15:27:00 +08:00
switch (getchar()) {
case '0': puts("You pressed 0"); break; case '1': puts("You pressed 1"); break; case '2': puts("You pressed 2"); break; case '3': puts("You pressed 3"); break; case '4': puts("You pressed 4"); break; case '5': puts("You pressed 5"); break; case '6': puts("You pressed 6"); break; case '7': puts("You pressed 7"); break; case '8': puts("You pressed 8"); break; case '9': puts("You pressed 9"); break; } |
3
sNullp 2015-11-11 15:48:11 +08:00 via iPhone
想想函数式语言。。
|
4
Executable OP @aheadlead 能不能写个阶乘啊……
|
5
aheadlead 2015-11-11 17:39:33 +08:00 1
switch (getchar()) {
case '0': puts("1"); break; case '1': puts("1"); break; case '2': puts("2"); break; case '3': puts("6"); break; case '4': puts("24"); break; case '5': puts("120"); break; case '6': puts("720"); break; case '7': puts("5040"); break; case '8': puts("40320"); break; case '9': puts("362880"); break; } |