for example
invoice.exe < purchase.dat > statement.txt
do i replace that where all the cin statements? i created a text file called purchase.dat with values:
gameboy 149.99 1
ipod nano 220.99 2
DVD-player5 60.95 1
rubics cube 8.85 5
so i.e. below is some coding tat is in working progress. i able to make it tat it prints price, cost, quantity, and product id. i have to use piping. where do i put this statement: invoice.exe < purchase.dat > statement.txt
in the code?
Expand|Select|Wrap|Line Numbers
- for (int i = 0; i <= maxitems; i++)
- {
- cout << "product: ";
- getline(cin, productid);
- cout << "quantity; ";
- cin >> quantity;
- cout << "price: ";
- cin >> price;
- cost = quantity * price;
- totalcost = totalcost + cost;
- cout << setw(34) << productid << setw(10) << quantity << setw(10) << price << setw(12) << cost << endl;
- } cout << "Total: " << totalcost << endl;