hey there, I've made some changes of your initial code, it has some errors such as:
int divYear = divYear();
first divYear as a function doesn't have a parameter, in which it has to take a parameter which is in your case "division" however division is a struct, so you should define it as a structure parameter in the function.
second, you defined divYear as being int where as struct comDiv defines its elements as float, the addition of floats will give floats, so you either have to convert it into int, or you should change int to float.
as for the array, i guess you're on the right track if you need to input for 4 persons. but if you just need to input for one person, you will not need an array
Is your assignment 1 or 4 divisions with 4 sales?
The following is for 1 division.
If your assignment says you need to use an array I would start with the following:
i've got the main stuff figured out. but now there's some file operations i'm trying to figure out. I'm trying to figure out how to read back code from the saved file to figure out the total yearly corporate sales, etc (see near bottom)
my teacher said something about using the max and min values for the high and low quarters, but i have to pass not just the numbers but the names of the division, and the number of the quarter
it was in pdf form on the website for the class so i had to save it and upload it there.
basically i just need help with the end. it has to basically display the struct. for "highest quarter" it should show the name of the highest quarter, the number of the quarter, and the value in the quarter (and the opposite for lowest)
the first bug is that we have to initialize totalDivSales to zero, either in the for loop as I did, or in the struct.
division[i].totalDivSales = 0;
the second bug was that you wanted to print out Total Yearly Corporate Sales using division[i].totalDivSales which gives you an error because it doesn't read i, in all cases, even if it reads i, i will be 4, then you will only get the last totalDivSales, whereas you need the sum of 4 of them. so what I did is simply I defined a new element called total, set it to zero, than I added the 4 totalDivSales to it in the last loop.
if you have any question, don't hesitate to get back to me