level 8
细雨言
楼主
B语言是贝尔实验室开发的一种通用的程序设计语言,它是于1969年前后由美国贝尔实验室的电脑科学家肯·汤普森(Ken Thompson)在丹尼斯·利奇(Dennis Ritchie)的支持下设计出来。后来,丹尼斯·利奇以B语言为基础开发出C语言
下面是来自Ken Thompson的B语言用户手册的例子:
/* The following function will print a non-negative number, n, to
the base b, where 2<=b<=10, This routine uses the fact that
in the ANSCII character set, the digits 0 to 9 have sequential
code values. */
printn(n,b) {
extrn putchar;
auto a;
if(a=n/b) /* assignment, not test for equality */
printn(a, b); /* recursive */
putchar(n%b + '0');
}
2016年08月16日 03点08分
1
下面是来自Ken Thompson的B语言用户手册的例子:
/* The following function will print a non-negative number, n, to
the base b, where 2<=b<=10, This routine uses the fact that
in the ANSCII character set, the digits 0 to 9 have sequential
code values. */
printn(n,b) {
extrn putchar;
auto a;
if(a=n/b) /* assignment, not test for equality */
printn(a, b); /* recursive */
putchar(n%b + '0');
}