Assume proper includes have been executed, but not using directive or declaration. Write a definition of an iterator for a vector named vec of int values. Write a for loop that will display the contents vec on the screen, separated by spaces starting at the last element in the vector and proceeding to the first. Use iterators for the loop control.
What will be an ideal response?
```
#include
#include
using std::vector;
using std::cout;
using std::endl;
int main()
{
std::vector
std::vector
for(int i=0; i<10; i++)
vec.push_back(i);
for (itr = vec.rbegin(); itr != vec.rend(); itr++)
cout << *itr << " ";
cout << endl;
return 0;
}
```
Computer Science & Information Technology
You might also like to view...
Tab scrolling buttons are located ________ the sheet tabs
A) below the sheet tabs B) above the sheet tabs C) to the left of the sheet tabs D) to the right of the sheet tabs
Computer Science & Information Technology
In GIF format, greater compression is achieved by further limiting the ____ of the graphic.
A. physical size B. color palette C. format D. style attributes
Computer Science & Information Technology