Algiuen que me ayude con unas matrices

Carlos
29 de Mayo del 2004
Hola necesito la ayuda en un progrma que me lee 2 mtarices de 5*5 me las multplique, las sume y me muestre el resultado en pantalla, esto a trves de un menu, no olvidemos que esto toca con funciones, gracias agradesco su ayuda, es una para una tareilla que me toca desarrolar

noel solw
29 de Mayo del 2004
Te envio un programa que realiza la suma y el producto de dos matrices 5*5.
El menu y todo lo demas queda a tu cargo.

// program MatOp.CPP
// for the given matrix of integers : a(5x5), b(5x5)
// calculate : 1 - a + b
// 2 - a * b
// written in Borland C++ ver 4.5

#include <conio.h>
#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>

const int N = 5;


void Init(int a[][N])
{
for(int i = 0; i < N; i++)
for(int j = 0; j < N; j++)
a[i][j] = random(20) + 1;
} // INIT MATRIX

void Show(int a[][N],char *msg)
{
cout << msg << " : " << endl << endl;
for(int i = 0; i < N; i++)
{
for(int j = 0; j < N; j++)
cout << setw(6) << a[i][j];
cout << endl;
}
cout << endl;
} // SHOW MATRIX

void Sum(int a[][N],int b[][N],int c[][N])
{
for(int i = 0;i < N;i++)
for(int j = 0;j < N;j++)
c[i][j] = a[i][j] + b[i][j];
} // SUM

void Mult(int a[][N],int b[][N],int c[][N])
{
for(int i = 0;i < N;i++)
for(int j = 0;j < N;j++)
{
c[i][j] = 0;
for(int k = 0;k < N;k++)
c[i][j] += a[i][k] * b[k][j];
}
} // MULT

void main()
{
randomize();
int a[N][N],b[N][N],c[N][N];
Init(a);
Init(b);
Show(a,"matrix a");
Show(b,"matrix b");
Sum(a,b,c);
Show(c,"c = a + b");
Mult(a,b,c);
Show(c,"c = a * b");
cout << "end of program - good bye ! ! !n";
} // MAIN