printq

printq - } } /* Your task:->overwrite jobs.dbf with the...

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

View Full Document Right Arrow Icon
/** @file printq.cpp @author Hillary Hacker @date 2005-09-12 Description: Client file that uses the naivepq library Logon ID: cs1254xx Lab #: 1 Instructor: William Duncan */ #include <iostream> #include <cstdlib> #include <fstream> #include "naivepq.h" int menu(void); using namespace std; int main(int argc, char **argv) { fstream fpjobs; job printq[MAX_JOBS]; int numjobs, menuretval, id; numjobs = 0; /* Your tasks: ->Open jobs.dbf binary files ->initialize numjobs ->store the contents of jobs.dbf into printq[] */ while((menuretval=menu())) { switch (menuretval) { case 1: addjob(printq, numjobs); break; case 2: cout<<"Enter the id of the job: "; cin>>id; canceljob(printq, numjobs,id); break; case 3: servicejob(printq, numjobs); break; case 4: printjoblist(printq, numjobs); break; default: ;
Background image of page 1

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

View Full DocumentRight 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: } } /* Your task:->overwrite jobs.dbf with the contents of the printq array.->close file */ return 0; } int menu() { int c; char dummy; while (1) { cout<<" P R I N T Q U E U E "<<endl; cout<<"====================================="<<endl; cout<<"Add job to queue. ................. [1]"<<endl<<endl; cout<<"Cancel job. ....................... [2]"<<endl<<endl; cout<<"Service print job. ................ [3]"<<endl<<endl; cout<<"Print job listings. ............... [4]"<<endl<<endl; cout<<"Quit. ............................. [0]"<<endl<<endl; cout<<"Select an option: "; cin>>c; cin.ignore(80,'\n'); if (c < 0 || c > 4) { cerr<<"Invalid option. Press the [RETURN] key to continue."; cin>>dummy; } else return c; } }...
View Full Document

This note was uploaded on 01/17/2012 for the course CSC 1254 taught by Professor Blanks,l during the Fall '08 term at LSU.

Page1 / 2

printq - } } /* Your task:->overwrite jobs.dbf with the...

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