In: Computer Science
2. Create a new project named named lab5_2. You will prompt the user for an amount of names to enter, and then ask for that amount of names. You’ll store these names in a vector of strings. Then you’ll sort the vector. Finally, you’ll print the results.
How many names?: 4
Enter a name: Leonardo
Enter a name: Donatello
Enter a name: Michelangelo
Enter a name: Raphael
====================
Alphabetized
====================
Donatello
Leonardo
Michelangelo
Raphael
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
  
using namespace std;
  
int main()
{
vector<string> names;
   string name;
int n,i;
cout<<"How many names?: ";
cin>>n;
for (i = 0; i < n; i++){
   cout<<"Enter a name: ";
   cin>>name;
   names.push_back(name);
   }
   sort(names.begin(), names.end());
   cout<<"===================="<<endl;
   cout<<"Alphabetized"<<endl;
   cout<<"===================="<<endl;
   for (i = 0; i<n; i++){
     
cout<<names.at(i)<<endl;
   }
  
   return 0;
}

Output :

NOTE: If you want to change something , please let me know through comments; I will surely revert back to you.
Please give a up vote .....
Thank you...