l15.1a

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 1A 代码 · 共 34 行

1A
34
字号
#printWrite a program that reads in lines one at a time,and prints them out if their length (includingthe newline) is odd.You can use the function getline if you like; the objectfile is in getline.o.Compile and run it, then type "ready".#once #create Ref1this line contains an odd number of letters!this line, however, contains an even number of letters!#once #create Ref2this line contains an odd number of letters!#once cp %s/getline.o .#usera.out <Ref1 >x1#cmp x1 Ref2#succeed/* It's certainly easiest with getline: */ #include <stdio.h>main(){	char line[500];	int n;	while ((n = getline(line, 500)) > 0)		if (n % 2 == 1)			printf("%s", line);}#log#next15.1b 10

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?