Question
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
using namespace std;
template
int main() { vector
//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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started