#include #include #include //for class string using namespace std; int main() { struct samuelljackson { string title; int year; string character; }; const samuelljackson samm[] { {"PulpFiction", 1994, "Jules Winfield"}, {"DjangoUnchained", 2012, "Stephen"}, {"Kingsman:The_Secret_Service", 2015, "Richmond Valentine"}, {"The_Incredibles", 2004, "Frozone"}, {"Kong:Skull_Island", 2017, "Lt. Col. Preston Packard"}, {"The_Avengers", 2012, "Nick Fury"}, {"Shaft", 2019, "John Shaft II"}, {"Cell", 2016,"Tom McCourt"}, {"Unbreakable", 2000, "Mr. Glass"}, {"Jackie_Brown", 1997, "Ordell"} }; const size_t sam {size(samm)}; cout << "From what is currently in the database, what decade do you want to know how many movies Samuel L Jackson played in?\n"; int yr; cin >> yr; const int decade {yr / 10}; int howmany {0}; for (int h {0}; h < sam; ++h) { if (samm[h].year / 10 == decade) { howmany++; } } cout << "With what we have now, Samuel L. Jackson was in " << howmany << " movies in " << decade * 10 << "\n"; cout << "\n"; cout << "What film do you want to see? \n"; for (int i {0}; i < sam; ++i) { cout << samm[i].title << "\n"; } string film {}; cin >> film; cout << "\n"; for (int k {0}; k < sam; ++k) { if (film == samm[k].title) { cout << samm[k].title << " was released in " << samm[k].year << " and he played " << samm[k].character << "\n"; return EXIT_SUCCESS; } } cout << "\n"; cerr << "Sorry, either it's not here or that isn't a movie he was in...\n"; return EXIT_SUCCESS; }