blob: 3d4bf96dfab9a8084a14e8dc21a702e114a58529 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#print
Write a program which copies all lines containng
the letter 'p' from its input to its output.
Compile and test it; then type "ready".
#once #create Ref
mountain station south orange maplewood millburn short hills
new providence murray hill berkeley heights
bernardsville far hills peapack gladstone
#once #create badin
hoboken harrison newark roseville avenue grove street
east orange brick church orange highland avenue
mountain station south orange maplewood millburn short hills
summit chatham madison convent station morristown
new providence murray hill berkeley heights
gillette stirling millington lyons basking ridge
bernardsville far hills peapack gladstone
#once cp %s/getline.o .
#user
a.out <badin >xxx
#cmp Ref xxx
#succeed
/* a way to find lines with 'p' */
#include <stdio.h>
main()
{
char line[500];
int k;
while (getline(line, 500) > 0)
for (k = 0; line[k] != '\0'; k++)
if (line[k] == 'p') {
printf("%s", line);
break;
}
}
#log
#next
16.2c 5
17.1a 10
|