Question: can you help explain output of this C++ program const int a [ ] { 7, -12, 5, 11, -9, 25, 1, 7, 15, 0,

can you help explain output of this C++ program

const int a [ ] { 7, -12, 5, 11, -9, 25, 1, 7, 15, 0, 99, 7, };

template void print ( const T& x) ( cout << x << ' '; )

int main ( )

{

deque d; int u = 10, v = 20;

copy ( begin (a), end (a), front_inserter (d) );

for_each (d.cbegin ( ), d.cend ( ), print );

cout << endl;

cout << *find_if (d.cbegin ( ), d.cend ( ),

[ = ] (const int& x) {return x > u && x < v; } )

<< endl

d.erase ( remove (d.begin ( ), d.end ( ), 7 ), d.end

( ) );

copy ( d.cbegin ( ), d.cend ( ) -1, ostream_iterator

(cout, ":" ) );

cout << *( d.cend ( ) - 1) << endl;

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!