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

 

 


Tema destacado: Como proteger una cartera - billetera de Bitcoin


  Mostrar Mensajes
Páginas: [1]
1  Programación / Programación C/C++ / Ayuda con matrices en c en: 30 Noviembre 2017, 22:09 pm
BUENAS TARDES, soy nuevo en el foro y estaba necesitando ayuda con algunos temas de matrices , en C ...
Estoy empezando en esto de C Ya se declarar matrices, llamarlas con funciones, cargarlas y mostrarlas, y ahora quiero saber algunas cosas que no me salen... si alguien me puede ayudar GRACIAS

- Calcular el máximo de toda la matriz (lo intente plantear haciendo una función aparte , pero no me salio)

- Calcular el promedio de todos los positivos o todos los negativos de la matriz y imprimirla en otro vector

Realmente estoy leyendo muchos libros y viendo videos, pero hay temas que piden en ejercicios que no logro ver con ejemplos en los libros, y me cuesta plantearlos... y mas utilizando funciones.

Les agradezco la ayuda les dejo mi código :

#include <stdio.h>
#include <stdlib.h>

void cargamatriz (int matriz [][20],int f,int c);
void mostrarma (int matriz [][20],int f,int c);

int main()
{
    int f,c;
    int matriz [20][20];

    printf("Ingrese cantidad de filas y columnas:");
    scanf("%d %d",&f,&c);

    cargamatriz (matriz,f,c);
   mostrarma(matriz,f,c);
  }

void cargamatriz(int matriz[][20],int f,int c){
int i,j;

for (i=0;i<f;i++){
    for (j=0;j<c;j++){
        printf ("Ingrese valores en la posicion [%d][%d]",i+1,j+1);
        scanf("%d",&matriz[i ] [j]);
    }
}}

void mostrarma(int matriz [][20],int f,int c){
    int i,j;
 for (i=0;i<f;i++){
    for (j=0;j<c;j++){
        printf("[%d]",matriz[ i] [j]);
    }printf ("\n");
 }

}

Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines