Discuss the below:
Q: Consider the C++ array
int arr[] = (-15, 5, 35, -19, -12, 17, -4);
int arrSize = sizeof(arr)/sizeof(int);
(a) Declare the list object intList that holds the integers from the array arr.
(b) Declare the iterator iter for an integer list.
(c) Initialize the iterator iter to the beginning of the list intList.
(d) Assume iter is set to the start of the list.
iter++;
iter++; // what value does iter point at?
cout << *iter; // what is the output?
iter = intList.end();
iter--;
iter--; // what value does iter point at?
cout << *iter; // what is the output?
iter = intList.end();
iter++; // what value does iter point at?
cout << *iter; // what is the output?
(e) Use the iterator to write a code segment that scans the list elements and replaces each negative value by the corresponding positive number.