0

Matrix in array

I wanna ask a question that i cant solve it by my self. Create a program to create 2 grayscale image matrices A and B whose random element value (0.255) then specify the matrix of image C which is a combination of A and B (Cij = Aij + Bij) with the rule if Cij> 255 then Cij = Max (Aij, Bij). Please help me

28th Oct 2017, 3:51 PM
Hayfa Tsurayya
Hayfa Tsurayya - avatar
3 Answers
+ 1
i assume you able to create matrix and fit it. A[i][j]+B[i][j] > 255 ? C[i][j] = max(A[i][j], B[i][j]) : C[i][j] = A[i][j]+B[i][j]; and don't forget use: #include <algorithm>
28th Oct 2017, 4:41 PM
Yuri Lyagin
Yuri Lyagin - avatar
0
How to use the rand function in that matrix?
28th Oct 2017, 9:36 PM
Hayfa Tsurayya
Hayfa Tsurayya - avatar
0
try to use google to searching simple things http://www.cplusplus.com/reference/cstdlib/rand/ v1 = rand() % 101; // v1 in the range 0 to 100
29th Oct 2017, 1:58 PM
Yuri Lyagin
Yuri Lyagin - avatar