My solution doesn't pass your tests. It compiles on my local system and seems to satisfy the requirements. I am using mingw492_32 compiler on my computer.
Question: How do I wrap this in a code block where it picks up my includes and angle brackets accurately?
(pound symbol)include < iostream>
(pound symbol)include < list>
using namespace std;
int main(void) {
int val;
list< int> array;
cout << "Input:" << endl;
while (true) {
cin >> val;
if (val > 99 || val < -99)
continue;
if (val == 42)
break;
array.push_back(val);
}
cout << "\n\nOutput:" << endl;
for (list<int>::iterator iter = array.begin(); iter != array.end(); iter++)
cout << *iter << endl;
return 0;
}