写排序算法在他们的应用中。修复我的(短)的Python到C#算法港口
public class Calculation
{
protected DateTime Epoch = new DateTime(1970,1,1);
protected int EpochSeconds(DateTime date)
{
var td = date - Epoch;
return td.Days*86400 + td.Seconds + ((td.Milliseconds)/1000000);
}
protected int Score(int upVotes,int downVotes)
{
return upVotes - downVotes;
}
public int HotScore(int upVotes,int downVotes,DateTime date)
{
var s = Score(upVotes, downVotes);
var order = Math.Log(Math.Max(Math.Abs(s), 1), 10);
var sign = Math.Sign(s); //Edit from Jonathon Reinhart
var seconds = EpochSeconds(date) - 1134028003;
return Math.Round(order + sign + *seconds/45000, 7);
}
}
编辑以获取更多信息
具体我就上线得到一个错误
return Math.Round(order + sign + *seconds/45000, 7);
//error "The * or -> operator must be applied to a pointer"
“
最接近的比赛,我可以在方法签名中找到是这样的: http://msdn.microsoft.com/en-us/library/f5898377
究竟是什么问题? – 2012-08-07 20:53:55
究竟是什么问题,或者你有什么问题? – goric 2012-08-07 20:54:11
如果可能,我想检查一般错误,但我也添加了特定的构建错误。 – Wesley 2012-08-07 20:56:49