Help with struct program

Hello, trying to get back into c++ but I'm having a hard time. Getting errors with me struct variable usage on lines 31 and 33,and I'm not sure why. Advice would be appreciated.

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
51
52
53
54
55
 #include <iostream>
#include <fstream>

using namespace std;

struct newType{

    char *name;
    double quarter[4];
    double sales = 0, average = 0,total = 0;

};

int main()
{
    newType division[4];
   
   

    division[0].name = "East";
    division[1].name = "West";
    division[2].name = "North";
    division[3].name = "South";

    for(int i = 0; i < 4; i++)//Prompts user for sales data, then adds up sales data to form a total of all sales.
	{
		for(int x = 0; x < 4; x++)
	{
	    cout << "Please enter the sales for the " << division[x].name << " for: " << endl;
        cout << "Quarter: " << i + 1 << ": " << endl;
        cin >> division[x].quarter[i].sales;
        
        newType total = division[x].quarter[i].sales + total;
        


    }
}
    
    for(int p = 0; p < 4; p++)// Calculates average for each quarter.
	{
		for(int t = 0; t < 4; t++)
	{
		
        cout << "Average for quarter:" << p +1 << ": "divison[p].quarter[t].average = quarter[i].sales + quarter.average;
        
	}
}

     cout <<"Total sales :" << newType total;
     

    
    return 0;
}
division[x].quarter[i] is OK (returns a double)
division[x].quarter[i].sales is not OK because double has no member called sales.
So I guess that you actually want to define a new struct for quarter that has members sales, average, total.
Topic archived. No new replies allowed.