Explore BrainMass
Share

declare and store elements of array into vector object

4. Write a statement that declares and stores the elements of the following array into a vector object:

char vowels[5] = {'a', 'e', 'i', 'o', 'u'};

8. What is the output of the following program segment? (Assume that screen is an ostream iterator initialized to the standard output device to output elements of the type int.)

int list[5] = {2, 4, 6, 8, 10};
vector<int> vecList(5);

copy(list, list + 5, vecList.begin());

copy(vecList.begin(), vecList.begin());

copy(vecList.begin(), vecList.end(), screen);
cout<<endl;

© BrainMass Inc. brainmass.com June 23, 2018, 5:57 pm ad1c9bdddf

Solution Summary

It is comprised of codes on how to declae and store the elements of the following array into a vector object. It further explains the output of the program segment.

$2.19