Computer Science, asked by dhanamvijay2002, 10 months ago

Please help me FRIENDS...

Write a C++ program for this question.
Each morning, a bureacrat receives letters, each letter has an identifying number, and denotes a job that takes one hour's work.  The bureaucrat places the letters in an "In-tray", one above the other, with the letters received earlier below those received later.  Each day the bureaucrat works for at most 8 hours. In each hour, he picks up the letter if any from the top of In-tray, does the job and throws away the letter.  If the jobs finish early, the bureaucrat goes home early; if the jobs do not finish in the 8 hours, the letters remain in the In-tray. The next day, the arriving letters are put on top of the In-tray, as usual.

Write a program to model this process.  Its input should be in the following form. First there is a number n, denoting the number of days to be modelled.  Following that there are n sequences of numbers, the ith sequence describing the letters arriving on the ith day.  Each

sequence starts of with a number giving the number of letters in the sequence, following which are the ids of the letters (in arrival order).Your program is to print the ids of the letters left

unprocessed at the end of the n days, if any, from the bottom of the In-tray to the top.You should assume that the In-tray will never have more than 20 letters.

Input instance (it is OK if the letter ids repeat)

2

10 1 2 3 4 5 6 7 8 9 10

9 11 2 3 4 5 6 7 8 9

Output

1

2

11

Answers

Answered by smartydevil
2

//Hello worl program

#include<iostream.h>

#include<conio.h>

void main()

{

           clrscr();

            printf (Each morning, a bureacrat receives letters, each letter has an identifying number, and denotes a job that takes one hour's work.  The bureaucrat places the letters in an "In-tray", one above the other, with the letters received earlier below those received later.  Each day the bureaucrat works for at most 8 hours. In each hour, he picks up the letter if any from the top of In-tray, does the job and throws away the letter.  If the jobs finish early, the bureaucrat goes home early; if the jobs do not finish in the 8 hours, the letters remain in the In-tray. The next day, the arriving letters are put on top of the In-tray, as usual. );

                    getch();

}

Explanation:

Answered by AneesKakar
0

The C++ code for the given question is as below -

#include <iostream>

#define repeat(x) for(int _iterator_i = 0, _iterator_limit = x; _iterat

#define main_program int main()

#include <cmath>

using namespace std;

int main(){

int intray[25], top=0;

int n; cin >> n;

for(int i=0; i<n; i++){

int nToday; cin >> nToday;

for(int j=0; j<nToday; j++){

int letter; cin >> letter;

intray[top] = letter;

top++;

}

top = max(top-8,0);

}

for(int i=0; i<top; i++)

cout << intray[i]<<endl;

}

#SPJ3

Similar questions