#include <iostream>
#include <list>
using namespace std;
int main() {
// 305 42 68
//int x, y, z;
//cin >> x >> y >> z;
// ------------------------------
// ARRAYS: FIXED SIZE -- accessible by index
// ------------------------------
const int NUM_GRADES = 5;
char grades [NUM_GRADES] = {'A', 'B', 'C', 'D', 'F'};
for (int i=0; i < NUM_GRADES; ++i) {
cout << grades[i] << " ";
}
cout << endl;
for (int i=NUM_GRADES-1; i >= 0; --i) {
cout << grades[i] << " ";
}
cout << endl;
int scores [5] = {1, 2, 3, 4, 5};
int sum = 0;
for (int i=0; i < 5; ++i) {
sum += scores[i];
}
cout << "The sum of scores is: " << sum << endl;
// replacing an item of an array
grades[0] = 'E';
for (int i=0; i < NUM_GRADES; ++i) {
cout << grades[i] << " ";
}
cout << endl;
// ------------------------------
// LIST (doubly linked list)
// ------------------------------
list<int> listScores;
for (int i =0; i < 5; ++i) {
listScores.push_front(i);
listScores.push_back(i);
}
// access by an iterator
for (list<int>::iterator it=listScores.begin(); it != listScores.end(); ++it) {
cout << *it << " ";
}
cout << endl;
// access using range based for loop
for (auto const& i : listScores) {
cout << i << " ";
}
cout << endl;
return 0;
}