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

 

 


Tema destacado: Tutorial básico de Quickjs


  Mostrar Mensajes
Páginas: [1]
1  Programación / Programación C/C++ / obtener el número máximo y el número mínimo de matriz aleatoria c++ en: 4 Julio 2018, 03:57 am
Hola Buenas a Todos, necesito ayuda con una matriz aleatoria pues apenas comienzo con el tema y estoy un poco confundido, bueno es que quiero que también me muestre el numero máximo y el número mínimo generado en la matriz mi código es este y agradecería mucho su ayuda en este foro  
Código
  1. #include<iostream>
  2. #include<stdlib.h>
  3. #include<time.h>
  4.  
  5. using namespace std;
  6.  
  7. int main(){
  8. int matriz[100][100],filas,columnas;
  9. int matriz2[100][100],dato=0;
  10. int min=0;
  11. int max=0;
  12. cout<<"\n\tBIENVENIDO A LA MATRIZ ALEATORIA :3\n";
  13. system ("PAUSE");
  14. cout<<"Digite el numero de filas: "; cin>>filas;
  15. cout<<"Digite el numero de columnas: "; cin>>columnas;
  16.  
  17. srand(time(NULL));
  18.  
  19. for(int i=0;i<filas;i++){
  20. for(int j=0;j<columnas;j++){
  21. dato = 1+rand()%(1000);
  22. matriz[i][j] = dato;
  23. }
  24. }
  25.  
  26. for(int i=0;i<filas;i++)
  27. {
  28. for(int j=0;j<columnas;j++)
  29. {
  30. matriz2[i][j] = matriz[i][j];
  31. }
  32. }
  33. cout<<"\n\t MOSTRADO DE MATRIZ ::>>\n";
  34. for(int i=0;i<filas;i++)
  35. {
  36. for(int j=0;j<columnas;j++)
  37. {
  38. cout<< matriz2[i][j]<<" ";
  39.        }
  40.       cout<<endl;
  41. }
  42.  
  43. system("pause");
  44. return 0;
  45. }
  46.  



· Los códigos deben ir en etiquetas GeSHi
· No se debe escribir en mayúsculas
>aquí las reglas del foro
-Engel Lex
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines