Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Read ints from cin and store values into nums until you see a 0 (do not store the 0). Then print the middle value you

Read ints from cin and store values into nums until you see a 0 (do not store the 0). Then print the middle value you read in (will always be an odd number of values). Hint: you should be making use of push_back(val) and size()

#include #include

using namespace std;

template void print(const vector& v) { for (auto myIt = v.begin(); myIt != v.end(); ++myIt) { cout << *myIt << " "; } cout << endl; }

int main() { vector nums;

//Do not modify anything on or above the line below this //YOUR_CODE_BELOW

int num; cin >> num; while(num != 0) { //add to the vector cin >> num; } //print middle item

//YOUR_CODE_ABOVE //Do not modify anything on or below the line above this

}

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

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

Tell the merits and demerits of Mendeleev's periodic table.

Answered: 1 week ago

Question

5. Develop the succession planning review.

Answered: 1 week ago