Been working on some C++ exercises and what I’m doing is finding out the 5 number summary(max, min, q1,q2,q3) and the number of inputted ints for a group of integers that are inputted. This is an extension of an exercise for Accelerated C++. There are a few things that I’m unsure of. Firstly how do to refer to the last element if I don’t know how many elements there are in the vector. It also shows the results once you input the ints that you want to have in and then end-of-file. How do you end-of-file in a program. I’ve tried pressing the end button but it doesn’t work. Also I have used one and two as the 1st and 3rd quartile respectively. Have I done the right thing, if not, why not and how would you do it. Thanks for the help.

Code:#include<algorithm> #include<iomanip> #include<ios> #include<iostream> #include<string> #include<vector> using namespace std; int main() { cout<<"Please input your numbers:"; vector<int> numbers; int number; while(cin>>number) numbers.push_back(number); typedef vector<int>::size_type numbersize; numbersize size=numbers.size(); if(size==0){ cout<<endl<<"You must enter your numbers"<<endl; return 1; } //sort the grades sort(numbers.begin(),numbers.end()); //computer the median homework grade numbersize mid=size/2; double median; median= size % 2 ==0 ? (numbers[mid] +numbers[mid-1])/2 : numbers[mid]; numbersize one= mid/2; numbersize two=mid + one; cout<<"The median is: "<<median; cout<<"The 1st quartile is: "<< one; cout<<"The 3rd quartile is: "<<two; cout<<"The min value is: "<<numbers[0]; cout<<"There are "<<numbers.size()<<" elements that you inputted"; }