data structure

I have to do this:
Information on the sale and purchase of a company will be saved in a data structure.
Struct consists of the name of the shopping company, the shopping type (buy or sell),
the amount of shopping, date of shopping and shopping description (like discount).
1. Define the data structure to keep the information about 1000 companies.
2. This data structure was assumed that the necessary information has been entered in
advance, please write the function that calculate how much the sale and purchase of the
company are. (do not write main() function…)

and I have this code but it do not work. What is/are the problem/s?

#define n_shop 1000

struct Date
int day;
int month;
int year;
struct Company
char shop[50];
char bos;
float amount;
Date d_shopping;
int disc;

float calculate (Company total)
int i;
for (i=0; i<n_shop; i++)
total=total - name[i].amount + (name[i].amount*(name[i].disc/100));
total=total + name[i].amount - (name[i].amount*(name[i].disc/100));

return total;
total is of type Company. You are trying to use it in the calculations and then return the result of type Company where you should return result of type float.
Topic archived. No new replies allowed.