清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
class AveController < ApplicationController def index end def calculate @i=0 @course_number=params[:course_number].to_i session[:course_number]=@course_number end def result @score=[] @balance=[] @sum=0 @total_score=0 @result=0 length=session[:course_number] for i in 0..length @score<<params["course#{i}"] end for i in 0..length @balance<<params["credit#{i}"] end for i in 0..length @sum=@sum+@score[i].to_i*@balance[i].to_i end for i in 0..length @total_score=@total_score+@balance[i].to_i end @result=@sum/@total_score end end