elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


  Mostrar Mensajes
Páginas: 1 [2]
11  Programación / Programación C/C++ / matriz en C nose como encarar el ejercicio se agradece la ayuda en: 13 Octubre 2020, 03:46 am
Se debe buscar el primer valor pasado dentro de la matriz en nuestro
ejemplo (elem) por fila y reemplazar por el otro valor pasado (elem2) como parámetro
Observar el ejemplo siguiente:


https://ibb.co/8Mbr2jR


este es el codigo que tengo en C hasta ahora me me falta la ultima funcion en donde se deberia encontrar el numero 2 para despues cambiarlo  al numero 3.
si me pueden ayudar por favor se agradeceria, se que es con if y else pero nose como encarar bien el ejercicio.

Código
  1. #include <stdio.h>
  2. void mostrorigen(int [][5]);
  3. void mostrcamb(int [][5],int,int );
  4. int main()
  5. {
  6. int matri[5][5],f,c,elem;
  7. for (f=0;f<=4;f++)
  8. {
  9. for (c=0;c<=3;c++)
  10. {
  11. printf("Ingrese el elemento f%d , c%d ",f,c);
  12. scanf("%d",&matri[f][c]);}
  13. }
  14. mostrorigen(matri);
  15. mostrcamb(matri,2,3);
  16. for (f=0;f<=4;f++)
  17. {
  18. for (c=0;c<=4;c++)
  19. {
  20. printf("%d",matri[f][c]);
  21. }
  22. printf("\n");
  23. }
  24.  
  25. }
  26.  
  27.  
  28. void mostrorigen(int matri[][5])
  29. {
  30. int f,c;
  31.  
  32. for (f=0;f<=4;f++)
  33. { for (c=0;c<=3;c++)
  34. { printf("%d",matri[f][c]);
  35. }
  36. printf("\n");}
  37.  
  38. }
  39. void mostrcamb(int matri[][5],int elem, int elem1 )
  40. {
  41. int f,c;
  42. for(f=0;f<=4;f++)
  43. { for (c=0;c<=3;c++)
  44. }

MOD: Utiliza etiquetas de Código GeSHi
Páginas: 1 [2]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines