我必須製作一個程序,該程序必須向用戶提供C中3個3的數組,然後在每個位置打印包含總和的sum_matrix。C程序中的多個錯誤
我還必須將它分成3個功能,我已經完成了它,但它似乎充滿了錯誤,我無法真正實現它的工作。
PS:righe
裝置線,colonne
列,inserisci
插入,somma
總和,stampa
打印。
#include <stdio.h>
#include <stdlib.h>
void leggi_matrice(int MAT[][], int nRighe, int nColonne);
void somma(int MAT1[][N], int MAT2[][], int nRighe, int nColonne);
void stampa_matrice(int MAT[][], int dim, int nRighe, int nColonne);
int main()
{
int mat_somma[][];
int mat1[][];
int mat2[][];
int nRighe = 3;
int nColonne =3;
leggi_matrice(mat1[][], nRighe, nColonne);
leggi_matrice(mat2[][], nRighe, nColonne);
void somma(mat1[][], mat2[][], nRighe, nColonne);
void stampa_matrice(mat_somma[][], nRighe, nColonne);
printf("\n\n\n");
system("PAUSE");
return 0;
}
void leggi_matrice(int MAT[][], int nRighe, int nColonne)
{
for (i=0 ; i<nRighe ; i ++);
for (j=0 ; j<nColonne ; j ++);
{
printf("Inserisci elemento");
scanf("%d", & MAT[i][j]);
}
}
void somma(int MAT1[][], int MAT2[][], int nRighe, int nColonne);
{
int mat_somma[][];
for (i=0 ; i<nRighe ; i ++);
for (j=0 ; j<nColonne ; j ++);
{
mat_somma[i][j] = MAT1[i][j] + MAT2[i][j];
}
}
void stampa_matrice(int MAT[][], int dim, int nRighe, int nColonne)
{
int mat_somma[][];
for (i=0 ; i<nRighe ; i ++);
for (j=0 ; j<nColonne ; j ++);
{
printf ("%3d",mat_somma[i][j];
}
}
有什麼錯誤? –
這是否編譯?我沒有看到我和j的定義。 –
**從不**說你的程序有錯誤而沒有發佈錯誤在這裏。 – abelenky