Commit | Line | Data |
---|---|---|
d6c1f319 C |
1 | |
2 | Write a main program which counts the number of command-line arguments | |
3 | it has which begin with the letter 'b'. Print the | |
4 | result in decimal. Compile and test it as usual. | |
5 | Then type "ready". | |
6 | #user | |
7 | a.out abc bcd efg rpq b bbvd >xxx | |
8 | grep 3 xxx >/dev/null | |
9 | #succeed | |
10 | /* a possible solution */ | |
11 | main(argc, argv) | |
12 | char *argv[]; | |
13 | { | |
14 | int i, k; | |
15 | ||
16 | for(i=k=0; i<argc; i++) | |
17 | if (argv[i][0] == 'b') | |
18 | k++; | |
19 | printf("%d\n", k); | |
20 | } | |
21 | #log | |
22 | #next | |
23 | 37.1a 10 |