+ 2
why i can't compile the code.i upload to the website.
matrix paste and plus problem.
8 odpowiedzi
+ 11
please provide some sample input.
also post the link to your code in the question details not the tag section. tags are for the language you are asking about.
I have linked the code below to help others who wish to help you
https://code.sololearn.com/cEXrfwrGK36U/?ref=app
+ 9
when you click Run, a window appears which says "Looks like your program requires input". In this window you must enter all possible inputs the program needs to complete execution.
This is a limitation of the compiler on sololearn.
+ 9
Have you tried this code on your pc?
+ 4
That damn long tag tho
+ 4
You need to change your copy constructor to const along with your overloaded assignment operator.
12 matrix_x(const matrix_x &A);
13 matrix_x operator+(const matrix_x &A);
14 const matrix_x & operator=(const matrix_x &A);
41 matrix_x::matrix_x(const matrix_x &A)
55 matrix_x matrix_x::operator+(const matrix_x &A)
64 const matrix_x & matrix_x::operator=(const matrix_x &A)
+ 2
It ensures that the object won't change. When you pass an object to a method it creates a temporary variable. A temporary variable can not bind to a non-const reference. The copy constructor must take a reference to a const object in order to be able to make copies of the temporary reference.
+ 1
i can't compile,in other word,i can't input some values
0
thanks a lot, but why i need add const