daily pastebin goal
56%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //II Tarea Estructura de Datos
  2. //Gabriel Ramírez R.
  3. //201020244
  4.  
  5.  
  6. #include <iostream>
  7. #include <string>
  8. #include <list>
  9. using namespace std;
  10.  
  11. string List_remplaza(string lista[], string elemen1, string elemen2)
  12. {
  13.        
  14.        int largo= sizeof(lista)/sizeof(lista[0]);
  15.        string lista_res[largo];
  16.        
  17.        for(int i =0; i < largo; i++){
  18.             if( lista[i] == elemen1){
  19.                 lista_res[i] = elemen2;
  20.                    
  21.  
  22.                 }
  23.                 else{
  24.                     lista_res[i] = lista[i];
  25.                 }
  26.                    
  27.         cout<<lista_res[i]<<" ";
  28.                 }
  29.            
  30.  
  31.         return "Succesful Process";
  32.    
  33. }
  34. int main()
  35. {
  36.     string prueba[] = {"Ana","Pedro","Juan","Ana","Maricela","Ana"};
  37.     string prueba1[] = {"Carro","Casa","Carro","Avion","Perro","Barco", "Carro", "Paracaidas"};
  38.     List_remplaza(prueba, "Ana", "PEPE");
  39.     List_remplaza(prueba1, "Carro", "TANQUE");
  40.     return 0;
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top