Question: 8.2 LAB: Middle item Given a set of data, output the middle item (if even number of items, output the two middle items). Ex: If

8.2 LAB: Middle item

Given a set of data, output the middle item (if even number of items, output the two middle items).

Ex: If the input is 5 7 9 11 13 -1 (a negative indicates end), the output is:

 

Ex: If the input is 5 7 9 11 -1, the output is:

 

Hint: First read the data into a vector. Then, based on the vector's size, find the middle item(s).

Complete on the csegrid and upload the main.cpp.

Even though this might be a good function, just complete in main.cpp

LAB

ACTIVITY

8.2.1: LAB: Middle item

0 / 10

Submission Instructions

These are the files to get you started.

main.cpp

Download these files

Compile command

g++ main.cpp -Wall -o a.out

We will use this command to compile your code

Submit your files below by dragging and dropping into the area or choosing a file on your hard drive.

main.cpp

Drag file hereorChoose on hard drive.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!