Guest User

Untitled

a guest
Dec 7th, 2019
94
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void testEjercicio2() {
  2. iterator it1 = file_iterable_pchar("ejercicios/PI2Ej2DatosEntrada.txt");
  3. while (iterable_has_next(&it1)) {
  4. char *linea = (char*) iterable_next(&it1);
  5. iterator it2 = split_iterable_pchar(linea, ",");
  6. list lista = list_empty(int_type);
  7. while (iterable_has_next(&it2)) {
  8. char *linea2 = (char*) iterable_next(&it2);
  9. //printf("%s,", linea2);
  10. int e = int_parse_s(linea2);
  11. list_add(&lista, &e);
  12.  
  13. }
  14.  
  15. int longitud = lista.size;
  16. int array[longitud];
  17. //printf("longi %d",longitud);
  18. for (int i = 0; i < longitud; i++) {
  19. array[i] = *(int*) list_get(&lista, i);
  20. //printf("%d",array[i]);
  21. }
  22.  
  23. int res = Ejercicio2(array,longitud);
  24. printf("Salida: %d \n",res);
  25. }
  26. }
RAW Paste Data