View Mode
Q: 16
What happens when you attempt to compile and run the following code? #include #include #include using namespace std; void print(int v) { cout<<v<<" "; } struct Sequence { int start; Sequence(int start):start(start){} int operator()() { return start++; } }; int main() { vector v1(10); generate_n(v1.begin(), 10, Sequence(1)); for_each(v1.begin(), v1.end(), print); cout<<endl; return 0; } Program outputs:
Options
Question 16 of 30

Premium Access Includes

  • Quiz Simulator
  • Exam Mode
  • Progress Tracking
  • Question Saving
  • Flash Cards
  • Drag & Drops
  • 3 Months Access
  • PDF Downloads
Get Premium Access
Scroll to Top

FLASH OFFER

Days
Hours
Minutes
Seconds

avail 10% DISCOUNT on YOUR PURCHASE