C++:使用一个函数的输出作为带有函数原型的头文件中另一个函数的参数

C++:使用一个函数的输出作为带有函数原型的头文件中另一个函数的参数,c++,function-prototypes,C++,Function Prototypes,我不知道如何使用函数averageRating的返回值。。。对于下一个函数,preferenceFactor。。。进行除法。非常感谢您的帮助 /** *Calculates the average rating of movies for a particular genre by the user 'u' *Calculated by: (#of movies rated in one genre)/(sum of all the ratings) * *@param movies i

我不知道如何使用函数averageRating的返回值。。。对于下一个函数,preferenceFactor。。。进行除法。非常感谢您的帮助

/**
 *Calculates the average rating of movies for a particular genre by the user 'u'
 *Calculated by: (#of movies rated in one genre)/(sum of all the ratings)
 *
 *@param movies is the number of movies in one genre
 *@param sumRatings is sum of the ratings by the user 
 *@return the average rating
 */
 virtual double averageRating(int numberOfMovies, double sumOfRatings) {
    return (numberOfMovies/sumOfRatings);
 }

 /**
  *Calculates the user's "preference factor".
  *Calculated by: (averageRating/generalAverageRating)
  *
  *@param sumOfRatings average rating for the same movie by all users
  *@return the user's preference factor
  */
 virtual double preferenceFactor(double generalAverageRating) {
  return ("averageRating's output(?) divided by generalAverageRating")
 }

您不能在PreferenceFactor中使用averageRating作为参数,以便PreferenceFactor有2个参数吗

virtual double preferanceFactor(double avrRating, double genAvrRating);
然后在调用prefFact时,将平均值x,y作为第一个参数传入?可以接受吗

也可以只传递3个参数2作为平均参数,第3个是genAvRate

virtual double preferenceFactor(int numberOfMovies, double sumOfRatings, double generalAverageRating) {
    return averageRating(numberOfMovies, sumOfRatings)/generalAverageRating;
}

然后在Prefact函数中,调用前两个参数的平均值?

@Massa还没有,因为我不知道该怎么办。你喜欢这个工作吗双平均=平均移动数,总和;返回双平均/一般平均@凯瑟:我不认为我所想的是,有了以上这些,我就可以退一步了。