naivepq

naivepq - static int assignjobid(job printq,int numjobs int...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/** @file naivepq.cpp @author Hillary Hacker @date 2005-09-12 Description: Implementation file for the naive printq personal library. Logon ID: cs1254xx Lab #: 1 Instructor: William Duncan */ #include <string> #include <iostream> #include <iomanip> #include "naivepq.h" using namespace std; /* private functions. */ /** Function: assignjobid Usage: id = assignjobid(printq,numjobs); This function assigns a unique job id to a new print job. @param printq an array representing the printer queue. @param numjobs the current number of jobs in the queue. @return a number in the range 1. .100 that has not been assigned to a job already in the queue.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: */ static int assignjobid(job printq,int numjobs) { int i, j, found; if (numjobs == 0) return 1; if (numjobs == MAX_JOBS) return 0; i = 0; while (i <= numjobs) { i++; j=0; found = 0; while(j<numjobs && !found) { if (printq[j].id == i) found = 1; j++; } if (!found) return i; } return numjobs+1; } /* Define these functions. See descriptions in the header file.*/ int addjob(job printq, int& numjobs) { } int canceljob(job printq, int& numjobs, int jobid) { } int servicejob(job printq, int& numjobs) { } void printjoblist(job printq, int numjobs) { }...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

naivepq - static int assignjobid(job printq,int numjobs int...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online