So, I am supposed to write a code for matrix addition by two dimensional float arrays. The code is supposed to ask the user to enter the dimensions of matrix A (m by n) and matrix B(p by q), given that I initialized the matrices by the function member (not sure if that is what it is called) "rand()%10", but when I try compiling it, gives me the following errors "array bound is not an integer constant before ‘]’ token" "expected ‘)’ before ‘,’ token" and "expected unqualified-id before ‘float’", all in line 6, and I really have no idea as to how I am supposed to fix the errors. So please help.
Line 31, 32: You can't allocate an array like that in C++. In C++, the compiler must know the size of the array at compile time. Also, you initialization of the arrays is not valid. As freddy92 implied, you need to allocate variable sized arrays using new or use std::vector.
Why are m,n,p,q global? They should be local to main.