今天用MFC對話框撰寫程式,用了numeric中的accumulate函式對串列累加求和,最后除錯報錯。
其中參與計算的引數全為浮點型
我的問題:
什么是函式模板?
_Ty1&&,_Ty2&&代表什么?
解決方案?


for (t = 0; t <= 4; t++)
{
cx = (line[1][t] * sin(syfwj[1][t]));
cy = (line[1][t] * cos(syfwj[1][t]));
gaizhengshu2 = line[1][t] * ((accumulate(sycx, sycx + 6, 0.0) - chazhi2) / (accumulate(line, line + 6, 0.0)));
gaizhengshu3 = line[1][t] * ((accumulate(sycy, sycy + 6, 0.0) - chazhi3) / (accumulate(line, line + 6, 0.0)));
sycx[1][t] = cx;
sycy[1][t] = cy;
sygaizhengshu2[1][t] = gaizhengshu2;
sygaizhengshu3[1][t] = gaizhengshu3;
}
_Ty _Accumulate(_InIt _First, _InIt _Last, _Ty _Val, _Fn2 _Func)
{ // return sum of _Val and all in [_First, _Last), using _Func
for (; _First != _Last; ++_First)
_Val = _Func(_Val, *_First);
return (_Val);
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/43682.html
標籤:基礎類
上一篇:如果一個三維混沌系統有一個正的李雅普諾夫指數,兩個負的,還是混沌系統嗎
下一篇:隨意輸入文本,改變視頻人物對白
