Anonymous
when enter the if dont return sol_size, return -1
Anonymous
I think it is a problem of buffer, how can I clear it?
Anonymous
I debugged the issue and the sol_size value is correct and enter to the if .. but the return not work lol
Anonymous
Is the if statement true?
Anonymous
Is currentsum=solnmbr?
Anonymous
yes
Anonymous
Anonymous
Anonymous
It is very crazy loll
Anonymous
Anonymous
Also add a line to cout solnumberand current sum
Anonymous
ok
Anonymous
Anonymous
Alex
how many threads do you have?
Anonymous
Not logic 😱😂🧐🤨😱🤯
Alex
do you have one place to call algorithm method?
Anonymous
Ur getting the correct output right wuts the problem here?
Anonymous
the return is not correct
Anonymous
It shows "entered" only when the values are equal so the if statement is doing its work
Anonymous
yes, and the return is not correct!
Anonymous
Ur returning 0 at the end no matter of the if nd else statement
Anonymous
no I am returnin sol_size
Anonymous
in the if
Anonymous
Do the return zero in the else statement
Anonymous
Nd show the output
Anonymous
yes but it is entering to the if not the else
Anonymous
and return 0
Anonymous
And where is this functiom being called?
Anonymous
Cn u show where u called this function
Anonymous
Is the function in a loop?
Anonymous
Anonymous
Return is zero cause sol size is zero
Anonymous
noooo
Anonymous
I am printing sol_size here, it is not zero
Anonymous
.
Anonymous
just put a breakpoint on the if (current_sum == sol_number) line and check yourself
Anonymous
I am printing with a cout and the sol_size is not zero but return 0
Anonymous
the return not work
Anonymous
Anonymous
Here u assigned it to be zero
Anonymous
Anonymous
are you saying this doesn't return 3?
Anonymous
no
Anonymous
Change size_t to int see if theres a chnNge
Anonymous
Anonymous
In the return
Anonymous
step one line (step over button)
Anonymous
And how does sol_size change its value from 0 to smtng else?
Anonymous
the function hasn't executed yet
Anonymous
And how does sol_size change its value from 0 to smtng else?
because dont return 0 in the if, print the 0 of the last of the function
Anonymous
wew
Anonymous
🤯
Anonymous
can you post to some pastebin?
Anonymous
https://pastebin.com/7fmjRW97
Anonymous
If you have clion I can pass you all the folder to compile it
Anonymous
it's fine i'll just copy paste
Anonymous
I have also a class .h and input file
Anonymous
If someone like to test it
Anonymous
I have also a class .h and input file
step through your program
Anonymous
you never updated your sol_size
Anonymous
yes I know
Anonymous
step over at this point 2 times
Anonymous
sol_number dont need to be updated
Anonymous
Anonymous
Yes I update
Anonymous
algorithm(row_number, i + 1, sol_size + 1, current_sum + matrix[row_number][i]); sol_size + 1
Anonymous
Yes I update
no you are not
Anonymous
look at the call stack at this point
Anonymous
which function you are in, which function this returns to, and whether you make an assignment there
Anonymous
Anonymous
Yes but I am returning sol_size
Anonymous
Yes but I am returning sol_size
and you are not assigning it
Anonymous
sol_size = algorithm(i, 2, 0, 0); std::cout << "Returned: " << sol_size << std::endl;