Explore BrainMass
Share

Data structures in C++

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

Please include the code.

Trace the following code, and display the resulting elements in the list.

int arr[] = {1, 2, 3, 4];
int arrSize = sizeof(arr)/sieof(int);
list<int> intList (arr, arr+arrSize);
list<int> :: iterator iter = intList.begin);
int i;

for (i=1; i <= arrSize; i++)
intList.insert(iter++, i);

© BrainMass Inc. brainmass.com March 21, 2019, 4:23 pm ad1c9bdddf
https://brainmass.com/computer-science/cpp/data-structures-183680

Solution Preview

// iter1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <list>
#include ...

Solution Summary

A C++ code is traced and the resulting elements in the list are displayed.

$2.19