Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <vector>
- using namespace std;
- int main()
- {
- string nombre;
- vector< string > lista;
- int numero,mayor=0,pos,n;
- map<string,int> nombres;
- map<string,int> ::iterator p;
- cout<<"ingrese cantidad de datos que desea ingresar:";
- cin>>n;
- for(int i=0;i<n;i++)
- {
- cout<<"Ingrese nombre y su numero:";
- cin>>nombre>>numero;
- nombres[nombre]=numero;
- }
- cout<<"ingrese cantidad de datos que desea eliminar:";
- cin>>n;
- for(int i=0;i<n;i++)
- {
- cout<<"ingrese nombre a eliminar:";
- cin>>nombre;
- p=nombres.find(nombre);
- if(p!=nombres.end())
- nombres.erase(p);
- else
- cout<<"nombre no existe"<<endl;
- }
- p=nombres.begin();
- while(p!=nombres.end())
- {
- lista.push_back(p->first);
- p++;
- }
- for(int veces=0;veces<3;veces++)
- {
- mayor=-1,pos=-1;
- for(int i=0;i<lista.size();i++)
- {
- int cont=0;
- for(int j=0;j<lista[i].size();j++)
- if(lista[i][j]=='a' || lista[i][j]=='e' || lista[i][j]=='i' || lista[i][j]=='o' || lista[i][j]=='u')
- cont++;
- if(cont>mayor)
- {
- pos=i;
- mayor=cont;
- }
- }
- cout<<lista[pos]<<endl;
- lista.erase(lista.begin()+pos);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement