col2.c
Upload User: gzelex
Upload Date: 2007-01-07
Package Size: 707k
Code Size: 0k
Development Platform:

MultiPlatform

  1. // col2: filter for two-column output
  2. #include <LEDA/list.h>
  3. #include <LEDA/stream.h>
  4. main()
  5. {
  6.   list<string> L;
  7.   cmd_istream in("expand"); // expand tab's
  8.   while (in)  L.append(read_line(in));
  9.   if (L.length() % 2) L.Pop();
  10.   list_item a = L[0];
  11.   list_item b = L[L.length()/2];
  12.   while(b)
  13.   { int n = 38-L[a].length();
  14.     cout << L[a].head(38);
  15.     while (n-- > 0) cout << " ";
  16.     cout << "   " << L[b].head(38);
  17.     newline;
  18.     a = L.succ(a);
  19.     b = L.succ(b);
  20.    }
  21. }