Need help with reading a file into a loop and processing

I'm new to this and feel totally lost. The problem is to read info from a text file into a program that will calculate total sales and average daily sales for three people. The output is then written to another file. I have written several versions of loop codes, but none will run, and I keep getting an error in Visual Studio that the debug file cannot be found. Any help would be greatly appreciated!

The text file looks like this:
Mickey 400
Daisy 300
Donald 500
Mickey 1000
Daisy 700
Donald 200

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  // this program uses a loop to read in values
//from a file 
// I am modifying to read two values from each line of input

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

/*int a, b; (this is the inspiration for the structure)
while (infile >> a >> b)
{
    // process pair (a,b)
}*/

int main()
{
	ifstream inputFile; // file stream object
	inputFile.open("Sales.txt");// open the input file
	string a;
	int b,
		count;
	double average;
	while (inputFile >> a >> b){
		if (a= "Mickey"; b+=){
			count+=;
			average =( b/count);}
		if (a= "Daisy"; b+=){
			count+=;
			average = (b/count);}
		if (a= "Donald"; b+=){
			count+=;
			average = (b/count);}
		}
			
			}
//close the file
inputFile.close();
			
ofstream outputFile;
//open the output file
outputFile.open("Totals.txt");
outputFile << "Mickey's Total Sales: "; << mickeyTotalSales << ". Mickey's Daily Average: "; << (mickeyAverage);
outputFile << "Daisy's Total Sales: " << daisyTotalSales << ". Daisy's Daily Average: " << (daisyAverage);
outputFile << "Donald's Total Sales: " << donaldTotalSales << ". Donald's Daily Average: " << (donaldAverage);

system("pause");
return 0;
}
	
You have an extra closing curly brace right after your while loop.
Remove it and compile.
Topic archived. No new replies allowed.