The problem with my code is that it just gives an output of the "return -3" for example: "//User name exists, non zero rating
cout << getCountWatchedMovies("emma",users,5,4) <<endl;" expected is 2, and I got -3.
//User name exists, non zero rating
cout << getCountWatchedMovies("DaNieL",users,5,4) <<endl; expected 3, and I got 3.
for all the test cases my code gets -3 regardless
You assume that you have users and what the name of one of them is. Prove it.
How about you do on line 116: std::cout << "User " << i << ": #" << users[i].username << "# vs #" << username << "#\n";
(Or run with debugger and watch those variable at that point.)
That doesn't really solve my problem, I get:
Expected:
2
Got:
User 0: #Emma# vs #emma#
User 1: #Daniel# vs #emma#
User 2: #Rupert# vs #emma#
User 3: #Tom# vs #emma#
User 4: #Bonnie# vs #emma#
-3
The thing is that I should not get a name as an output, just a numerical output, which is what I have the problem with always getting -3 instead of 4, 2, 3, etc. I'm using codeRunner for this.