Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++, read the lines from a file given below and store them in the format discussed. Print them out afterwards to show your work

In C++, read the lines from a file given below and store them in the format discussed. Print them out afterwards to show your work

Each process is on one line of the file (after the first line). Each line consists of a series of integers that describe (in order):

First, the arrival time of the process (that is, when it is submitted): a positive integer.- store this as an int value.

After the arrival time, a series of CPU burst times (positive integers) and I/O burst times (negative integers): this list will contain at least one CPU burst time, and every process starts with a CPU burst. After the initial CPU time, the list may contain alternating I/O and CPU burst times. There is no maximum length for this list, but the information for each process will be contained on one line. The I/O bursts are listed as negative numbers for identification, but they represent positive values in reality.

For example, a line with this data

2 8 -20 4 -10 2

describes a process arriving at time 2, which requires 3 CPU bursts (length 8, 4 and 2) and 2 I/O bursts (length 20 and 10). Use two int arrays to store the CPU bursts and IO bursts separately. Find the sample test data below:

Sampledata.txt:

3

2 8 -20 4 -10 2

5 2 -22

6 6 -12 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago