|
|
1.1 root 1: // list test program. Takes one argument, reads standard input.
2: // removes copies of argument from input
3:
4: #include "String.h"
5: #include "list.h"
6:
7: listdeclare(String)
8:
9: String_list
10: remove(String s, String_list ls)
11: {
12: String temp;
13: if ( ls.getX(temp) ) {
14: if ( s == temp )
15: return remove(s, ls);
16: else return remove(s,ls).unget(temp);
17: } else return ls;
18: }
19:
20:
21: main(int argc, char **argv)
22: {
23: String_list slist;
24: String temp;
25: if ( argc != 2 ) {
26: cout << "must supply an arg\n";
27: exit(1);
28: }
29: String arg(argv[1]);
30: while ( cin >> temp)
31: slist.put(temp);
32: cout << remove(arg, slist) << "\n";
33: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.