Question: The following method returns a vector of five integers. vector myMethod() { int index; for (index = 0; index < 5; ++index) { vector myList;
The following method returns a vector of five integers.
vector myMethod()
{
int index;
for (index = 0; index < 5; ++index)
{
vector myList;
myList.push_back(index);
}
return myList;
}
Why won't the following code compile?
Rewrite the code so that it compiles and executes correctly. Include the two pieces of this question to receive full points.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
