+ 2

why i can't compile the code.i upload to the website.

matrix paste and plus problem.

18th Sep 2017, 9:51 AM
learnlearnlearn
learnlearnlearn - avatar
8 Réponses
+ 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
18th Sep 2017, 9:56 AM
jay
jay - avatar
+ 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.
18th Sep 2017, 10:00 AM
jay
jay - avatar
+ 9
Have you tried this code on your pc?
18th Sep 2017, 10:03 AM
jay
jay - avatar
+ 4
That damn long tag tho
18th Sep 2017, 10:07 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 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)
18th Sep 2017, 10:18 AM
ChaoticDawg
ChaoticDawg - avatar
+ 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.
19th Sep 2017, 1:23 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
i can't compile,in other word,i can't input some values
18th Sep 2017, 9:58 AM
learnlearnlearn
learnlearnlearn - avatar
0
thanks a lot, but why i need add const
19th Sep 2017, 12:31 AM
learnlearnlearn
learnlearnlearn - avatar