hi folks - i'm quite new to c++ and have written a program where i have used a linked list to simulate 3 printers working in a queue according to their priority. After much blood, sweat and tears I got that bit working.
Now I'm onto the second "easy" bit...I have to save the information as an array and display the data in various sorts ie in order of page numbers, priority and print order.
my struct looks like this
typedefstruct//the structure of each print job
{
int jobNo;
int priority;
int noOfPages;
int printOrder;
}aJOB;
my array...\\using 10 items to test
aJOB arrayPrint [10];
int main()
{
srand( (unsigned int) time( NULL ));
int jobNumber = 1;
printQ theQ;
int i=0; //counter for modulus and keeping time
int noOfPages = 1;
int choice;
int x=1;
int printer1 = 0;
int tempNo = 0;
aJOB* ptrArray = NULL; //declare a pointer to an int
ptrArray = arrayPrint;
cout<<"select an order to display"<> choice;
cout<printItem.printOrder = x++;
arrayPrint->jobNo = theQ.ptrHead->printItem.jobNo;
arrayPrint->noOfPages = theQ.ptrHead->printItem.noOfPages;
arrayPrint->printOrder = theQ.ptrHead->printItem.printOrder;
arrayPrint->priority = theQ.ptrHead->printItem.priority;
theQ.remove();
}
if (printer1 !=0) //printer holds the number of pages
printer1--;
if ((i % 10 == 0) && (tempNo != jobNumber) )
cout<jobNo<<"\t\t"<noOfPages<<"\t\t"<printOrder<<"\t\t"<priority< it appears not.
help and advice is much needed and would be much appreciated - i feel like i am so close!