/* File stock12.c */ /* Programmer: Tep Dobry */ /* login: ee160 */ /* Date: */ #include #include "folio10.h" #include "io_utils12.h" /* This program processes a number of stocks in a portfolio. */ /* It uses an array or strings for the id field for each stock*/ /* It uses a function, proc_stock, defined in a seperate file,*/ /* process_stock.c, to process each individual stock. The */ /* function returns the value of the stock. Its prototype */ /* statement is in stock.h. */ main() { int folio[MAX_STOCKS][MAX_COLS]; /* the portfolio data base */ char id[MAX_STOCKS][MAX_NAME]; /* the id strings */ float total_value = 0; /* the portfolio value, initialized to 0 */ float value[MAX_STOCKS]; int stocks; /* number of stocks in protfolio */ stocks = get_folio(id, folio); /* Accumulate the portfolio value */ total_value = proc_folio(stocks,folio,value); /* Print the portfolio value */ print_folio(stocks,id,folio,value); printf("Total\t\t\t\t%f\n",total_value); }