// Using the STL generic reverse algorithm with a vector. #include #include #include #include vector vec(char* s) // Return vector containing the characters of s // (not including the terminating null). { vector x; while (*s != '\0') x.push_back(*s++); return x; } int main() { cout << "Using reverse algorithm with a vector" << endl; vector vector1 = vec("mark twain"); reverse(vector1.begin(), vector1.end()); assert(vector1 == vec("niawt kram")); }