Whenever I run my program, It should be taking this string of information:
Shampoo 10 8.75 87.50
Pen 3 2.50 7.50
Headphones 5 20.99 104.95
MacAir 1 879.23 879.23
from one file and outputting it to another, the finished product should look like:
Shampoo 10 8.75 87.50
Pen 3 2.50 7.50
Headphones 5 20.99 104.95
MacAir 1 879.23 879.23
cheapest item = Pen
most expensive item = MacAir
total cost = 1079.18
shopper = Mary Kay
cheapest item = Oranges
most expensive item = Raspberries
total cost = 55.44
shopper = Winnie B. The Pooh
When I run my code however, it doesn't get past shampoo and will continue to add shampoo to the total cost infinitely. How can I change the code to produce the proper information? Thanks in advance.
CODE:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <float.h>
#include <sstream>
#include <string>
using namespace std;
For reference, this is what the output file looks like after I run my program:
Shampoo 10 8.75 87.50
Cheapest item: Shampoo
Most expensive item: Shampoo
Total Cost: 87.50
Shampoo 10 8.75 87.50
Cheapest item: Shampoo
Most expensive item: Shampoo
Total Cost: 175.00
Shampoo 10 8.75 87.50
Cheapest item: Shampoo
Most expensive item: Shampoo
Total Cost: 262.50
(this repeats constantly)