Hello. I have been working on a program that deals with array of structures. In this function, category report, i'm taking my structure and reading it through the a loop. Specifically, i'm reading category and price. In that loop there's a loop for the five categories. Basically, when it finds that category id number, it wants to write down all the publisher id's and prices for that category ID into an array. When it's searched for all the cases of category id 1 and recorded all the publisher and prices for it, it wants to send that info to printCategory (which is currently incomplete), reset, and move to category id 2..3... up to 5.

Yes, this is a homework assignment :P I have been at this for awhile, but i am stuck. I don't expect anyone to write it for me, but if i could get pointed in the right direction i'd appreciate it. Thank you.

```
struct Book{
int issn; //The book's issn number
int publisher; //The id of the book's publisher.
int category; //The id of the book's category.
double price; //The book's price.
}
book [max_books];
void categoryReport(Book[], int i)
{
int num[max_books];
double price[max_books];
int x = 0;
int j = 0;
int n = 0;
int c = 0;
for( j = 0; j < i; j++)
{
while(book[j].category == 1)
{
memset(num, 0, i);
memset(price, 0, i);
num[x] = book[j].publisher;
price[x] = book[j].price;
j++;
n++;
c = 1;
}
while(book[j].category == 2)
{
memset(num, 0, i);
memset(price, 0, i);
num[x] = book[j].publisher;
price[x] = book[j].price;
j++;
n++;
c = 2;
}
while(book[j].category == 3)
{
memset(num, 0, i);
memset(price, 0, i);
num[x] = book[j].publisher;
price[x] = book[j].price;
j++;
n++;
c = 3;
}
while(book[j].category == 4)
{
memset(num, 0, i);
memset(price, 0, i);
num[x] = book[j].publisher;
price[x] = book[j].price;
j++;
n++;
c = 4;
}
while(book[j].category == 5)
{
memset(num, 0, i);
memset(price, 0, i);
num[x] = book[j].publisher;
price[x] = book[j].price;
j++;
n++;
c = 5;
}
}
}
void printCategory(int c, int num[], double price[], int n)
{
cout << setw(30) << "BOOK PRICE REPORT\n\n";
cout << "CATEGORY\t";
cout << "PUBLISHER\t";
cout << "NUM OF BOOKS\t";
cout << "TOTAL PRICE\t";
cout << "AVERAGE PRICE\n";
cout << "******************************************************************************\n";
assignCategory(c);
cout << "\n";
}
```