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. 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.begin(); itr != vec.end(); itr++)
cout << *itr << " ";
cout << endl;
return 0;
}
```
Computer Science & Information Technology
You might also like to view...
To make changes to data in a form, you must be viewing the form in ________ view
Fill in the blank(s) with correct word
Computer Science & Information Technology
Which of the following commands will set the logging monitor to record security events with a priority at or above 3?
A) logging monitor 3 B) logging monitor 0-3 C) logging monitor 3-7 D) logging monitor debug 3
Computer Science & Information Technology