I've read the FAQs to this site and understand that we are not supposed to ask for answers to homework. This is a homework question, but I just want a hint, not a solution. I've been doing really well on the weekly assignments thus far but feel like I've hit a brick wall on this one.
We're supposed to have the user choose three movies to rate, and the user's input should be compared to the original 2d array of four reviewers. The program should then use "distance" (this is mandated in the assignment) to determine which of the four reviewers has the closest taste in movies and display that reviewer's ratings of the other movies. This is due tomorrow and I've been working on it for a week with no sudden breakthrough I was wanting... The distance isn't calculating the way I need it to. Any hints would be GREATLY appreciated.
Thank you for your response, ne555. Could you explain what you mean? What is "xor operator"? What do you mean by "define a square function"? I included stdio.h and math.h. And where should I be using a loop instead? The code that you copied is embedded in a for loop.
Replace the big sum with a for loop sum_square += square( userRating[K]-reviews[o][K] );
Also note that sqrt will return a float, but distance is an integer. You will lose information.
I included stdio.h and math.h
Those headers are deprecated. Include cstdio and cmath