You have too many semicolons, try this syntax instead
vector<string> path {"John", "Dave", "Peter", "Charlie", "Michael"};
Read more about initialization list syntax here: https://en.cppreference.com/w/cpp/language/list_initialization
You don't want a semicolon after the identifier, nor a semicolon in the {}
list, but only one at the end of the statement.
Additionally, path[5]
would be an attempt to use the sixth element, but you've only attempted to define 5.
vector<string> path {"John", "Dave", "Peter", "Charlie", "Michael"};
sort(path.begin(), path.end());
cout<< path[4] <<endl;
Output:
Peter