#include #include #include #include //for chrono::system_clock #include //for default_random_engine #include //for bind using namespace std; int main() { struct duty { string platform; string duty_station; }; const duty a[] { {"CVN", "Virginia"}, //Aircraft Carrier (Nuclear) {"LHD", "California"}, //Landing Helicopter Dock {"LPD", "Japan"}, //Landing Platform Dock {"LSD", "Florida"}, //Landing Ship, Dock {"DDG", "Italy"}, //Guided-Missle Destroyer {"CG", "Spain"}, //Cruiser {"SSN", "Bahrain"}, //Nuclear Submarine {"SSBN", "Greece"}, //nuclear-powered ballistic missile sub {"SSGN", "Hawaii"} //subsurface guided missle nuc pow sub }; const int n {size(a)}; //the number of structures in the array const unsigned seed = chrono::system_clock::now().time_since_epoch().count(); const default_random_engine engine {seed}; const uniform_int_distribution distribution; auto r {bind(distribution, engine)}; const int orders {r() % n}; //Random orders from 0 to n-1 inclusive cout << "I was stationed on a " << a[orders].platform << " in " << a[orders].duty_station << ".\n"; return EXIT_SUCCESS; }