/* * Standard containers, std::vector, exercise 1. * * Comparison with string added. */ #include #include #include // for range access begin() and end() #include using namespace std; const char letters[]{ "abcdefghijklmnopqrstuvwxyz" }; int main() { vector alphabet(begin(letters), end(letters)); copy(alphabet.cbegin(), alphabet.cend(), ostream_iterator(cout, " ")); cout << endl; copy(alphabet.crbegin() + 1, alphabet.crend(), ostream_iterator(cout, " ")); cout << endl; // std::string is basically a container string alphabet2(begin(letters), end(letters)); // string alphabet2 = "abcdefghijklmnopqrstuvwxyz"; copy(alphabet2.cbegin(), alphabet2.cend(), ostream_iterator(cout, " ")); cout << endl; copy(alphabet2.crbegin() + 1, alphabet2.crend(), ostream_iterator(cout, " ")); cout << endl; return 0; }