Miért nem akar müködni ez a c program ami beolvas két n*n-es mátrixot, majd kiirja mindketőt, kiszámolja az összegét a két mátrixnak és beleirja egy 3. mátrixba majd kiirja azt is?
#include<stdio.h>
#include<conio.h>
int n;
void olvas(int v[][])
{
int i,j;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
printf("v[%d][%d]",i, i);
scanf("%d",&v[i][j]);
}
}
}
void ir(int v[][])
{
int i,j;
printf("\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
printf("%d ",v[i][j]);
printf("\n");
}
}
}
void osszeg(int v[][],int c[][], int a[][])
{
int i,j;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;i++)
v[i][j]+c[i][j]=a[i][j];
}
}
int main()
{
int a1[20][20],a2[20][20],a3[20][20];
printf("n=");
scanf("%d",&n);
olvas(a1);
ir(a1);
olvas(a2);
ir(a2);
osszeg(a1,a2,a3);
ir(a3);
getch();
}
Ennek le se kéne fordulnia:
v[i][j]+c[i][j]=a[i][j];
Ennek tényleg nem kéne lefordulnia...
Nézz utána a = operátornak.
Ezt kijavitottam v[i][j]+c[i][j]=b[i][j];//AZ a helyett bre
itt vannak a hibaüzenetek :
6 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp declaration of `v' as multidimensional array must have bounds for all dimensions except the first
C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp In function `void olvas()':
13 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp `v' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
At global scope:
18 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp declaration of `v' as multidimensional array must have bounds for all dimensions except the first
C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp In function `void ir()':
25 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp `v' undeclared (first use this function)
25 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp At global scope:
31 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp declaration of `v' as multidimensional array must have bounds for all dimensions except the first
31 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp declaration of `c' as multidimensional array must have bounds for all dimensions except the first
31 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp declaration of `b' as multidimensional array must have bounds for all dimensions except the first
C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp In function `void osszeg()':
36 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp `v' undeclared (first use this function)
36 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp `c' undeclared (first use this function)
36 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp `b' undeclared (first use this function)
C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp In function `int main()':
6 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp too many arguments to function `void olvas()'
44 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp at this point in file
18 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp too many arguments to function `void ir()'
45 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp at this point in file
6 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp too many arguments to function `void olvas()'
46 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp at this point in file
18 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp too many arguments to function `void ir()'
47 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp at this point in file
31 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp too many arguments to function `void osszeg()'
48 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp at this point in file
18 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp too many arguments to function `void ir()'
49 C:\Documents and Settings\Black In Xp\Desktop\matrix.cpp at this point in file
Kapcsolódó kérdések:
Minden jog fenntartva © 2024, www.gyakorikerdesek.hu
GYIK | Szabályzat | Jogi nyilatkozat | Adatvédelem | Cookie beállítások | WebMinute Kft. | Facebook | Kapcsolat: info(kukac)gyakorikerdesek.hu
Ha kifogással szeretne élni valamely tartalommal kapcsolatban, kérjük jelezze e-mailes elérhetőségünkön!