Anonymous
I check first step. This is my code. int main()
{
int matris1[5][5] = {{21, 19, 17, 25, 28}, {71, 76, 73, 88, 59}, {153, 164, 164, 157, 155}, {200, 201, 190, 185, 180}, {205, 210, 215, 230, 232}};
int matris2[3][3] = {{-1, -1, -1}, {-1, 8, -1}, {-1, -1, -1}};
int i, j, sum, arr2Size = 3, arr1Size = 5, d = 0, k = 0, m = 0, s;
int out = (arr1Size - arr2Size + (2 * d)) / 1 + 1;
printf("%d", out);
int temp[out][out];
for (i = 0; i < arr2Size; i++)
{
for (j = 0; j < arr2Size; j++)
{
sum += matris1[i][j] * matris2[i][j];
}
temp[k][m] = sum;
}
printf("%d ", sum);
printf("%d ", temp[0][0]);
return 0;
}
olli
gotcha, I think it's clear enough now. In your code you don't change k or m. So you probably need to more for loops to iterate over your temp matrix, e.g.
for (int k = 0; k < ResultDimension; ++k) {
for (int m = 0; m < ResultDimension; ++m) {
/*
In here compute the "multiplication" for every
i and j in range
Sum += matris1[i + k][j + m] * matris2[i][j];
*/
Result[k][m] = Sum;
}
}
Prince Fine
then i took the input separately but what if the user enter
this 4 types how can i validate them
3 + 2i , 2i + 3 , 3 ,2i
Prince Fine
first user will enter the no in this 4 formats
a , bi , a+bi , bi + a
and then i want the code to accept and validate it so that complex c (c.real will find the real no even if the user enter the imaginary first)
4hk
Oh sry, https://pastebin.com/X4a8aYTN. how can I create a .txt with the data that was entered in "getDatos()", I am using <fstream> but there is an error that I don't understand