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::iterator itr;
std::vector vec;

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 define the new appearance for a button when a user rolls the mouse over the button, select the button, and then click [____] on the Buttons and Forms panel and make the changes.

A. Rollover B. Click C. Display D. View

Computer Science & Information Technology

When a style is previewed in the Styles pane, the document's:

A) character styles are listed first, followed by the paragraph styles. B) paragraph styles are listed first, followed by the character styles. C) character styles are listed first, followed by the bullet styles. D) bullet styles are listed first, followed by the paragraph styles.

Computer Science & Information Technology

Solver models can be saved and restored by clicking the Load/Save button on the ________ dialog box

A) Solver Parameters B) Scenario Data C) Scenario Manager D) Solver Manager

Computer Science & Information Technology

A ____ attribute specifies true or false.

A. spellcheck B. Boolean C. text-level D. full form

Computer Science & Information Technology