Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <string>
- #include <vector>
- using namespace std;
- int main(){
- int cantidad_nombres;
- cout << "Cuantos nombres quieres ingresar? :";
- cin>>cantidad_nombres;
- string nombres[cantidad_nombres];
- for(int i =0; i<cantidad_nombres; i++){
- cout << "ingrese el nombre " << i+1 << " : ";
- cin>>nombres[i];
- }
- vector<string> lista_nombres(nombres,nombres+cantidad_nombres);
- cout << "\t\t\tPresentando los nombres: " << endl;
- vector<string>::iterator it = lista_nombres.begin();
- sort(lista_nombres.begin() , lista_nombres.end());
- while(it != lista_nombres.end()){
- cout << *it << endl;
- *it++;
- }
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement