Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(ASAP) Beginner C++ Programming: Write a simple program to solve the task and give the exactly same output, as in the example. (ASAP) The task

(ASAP) Beginner C++ Programming: Write a simple program to solve the task and give the exactly same output, as in the example. (ASAP)

The task is to write a code, that produces EXACTLY the same output format in case of the given input, as in the example. It's good even if you cannot solve all the subtasks, but of course the more, the better please help ASAP. Look at the EXAMPLEs down below, and it will help to understand.

Please use ONLY simple algoritms, data structures. The STL library algorithms and data structures are NOT allowed. It must not be difficult, think about very simple algoritms, like sorting with loops and else-if statements for example. Only little time must be enough and hopefully not too many lines.

Task:

A library stores the following information about purchases: book code, theme code, year of purchase, number of pieces purchased. Data series are in ascending order by year.

Standard input:

Number of book purchases are in the first line of standard input (1N1000). This is followed by the library information about getting the books, line by line. The purchase lines contain the data in the following order: book code (0BCode100000), theme code (0TCode100), year (0Year100), number of pieces (1Pc100).

Standard output:

A line with a single # character must be written to the standard output before the result of each subtask, followed by one or more lines containing the result of the subtask! If you can't solve a subtask, you just have to write the # character! If the output does not meet this requirement in form (e.g. fewer/more # characters), the evaluator will send an "Output format error" message (even if there is a correct subtask solution).

Subtask 1: The first line should be the year in which you have the least, but at least 1 book acquired into the library! In an unclear case, the earliest year is the correct answer.

Subtask 2: The first row should include the number of years in which the library was and then in the second row, an ascending list of each year!

Subtask 3: In the first row, type the book code from which most of the library has been gathered over the years! In an unclear case, the first to occur is the correct answer.

Subtask 4: The first line should be the start and end years of the longest period in which there was no purchase. Find the period for the period between the first and last purchase years Apply! In a non-obvious case, the first of these! If there was a purchase every year, indicate this with "-1 -1"!

Subtask 5: The first row should include the number of topic codes in which the books belong there are only in the library! From the second line, the corresponding theme code and number of pieces are line by line, in the order in which the theme code first occurs.

Example Input:

6 1 11 10 3 2 22 10 2 2 22 11 4 1 11 18 9 4 4 19 1 11 11 25 3

Example Output:

# 19 # 5 10 11 18 19 25 # 1 # 12 17 # 3 11 15 22 6 4 1

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions