Home Segments Index Top Previous Next

447: Mainline

Suppose that you have a file that contains information about both stock trades and bond trades. Further suppose that trades are described in terms of the price per share, the number of shares traded, and the price–earnings ratio of the stock (an integer); bond trades are described in terms of the price per bond, the number of bonds traded, and the current yield of the bond (a floating point number). In both cases, the type of trade is marked by a leading integer, which is 0 for stock trades and 1 for bond trades:

0   3.3  300 10 
0   2.5  400 15 
1   9.9  100 4.5 
1  10.1  100 6.2 
0   5.0  200 12 
...