作者freelysoul (帥氣小活寶)
看板FJU-Stat96B
標題[閒聊] 程設 程式碼
時間Fri Mar 27 11:11:08 2009
#include <C:\devcpp\all.h>
double F1( double x )
{
return t_den(x,5);
}
double sample_mean( Univar Y )
{
double sum = 0.0;
for(int i=0; i <Y.size(); i++)
{sum = sum + Y[i];
}
return sum / Y.size();
}
double sample_var( Univar Y )
{
double Y_bar = sample_mean(Y);
double SS = 0.0;
for(int i =0; i < Y.size(); i++)
{ SS = SS + pow(Y[i]-Y_bar,2.0);
}
return SS/(Y.size()-1);
}
int main()
{
long int i, j;
srand((unsigned)time(NULL));
cout.setf(ios::fixed); cout.precision(10);
// $$$$$$$$ Start your program here $$$$$$$$$$$$$$$$$$$$$
Univar X(10);
X.nor_ran(0,1);
X.print(2);
cout << sample_mean(X) << endl;
cout << X.mean() << endl;
cout << sample_var(X) << endl;
cout << X.variance() << endl;
// $$$$$$$ End of your program $$$$$$$$$$$$$$$$$$$$$$$$$
cin.get();
return 0;
}
/*
cout << "Welcome to ....." << endl;
cout << " TIMING" << endl;
cout << "This is a interface developed by C++" << endl;
cout << "for Statistical and numerical computation" << endl;
cout << "This is a free software !! " << endl;
cout << "Anyone can use this interface ! " << endl;
cout << "Selling this interface is absolutly prohibited !" << endl;
cout << " Copyright by" << endl;
cout << "Lee, Tai-Ming 2009 2/15" << endl;
*/
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.136.162.144
噓 kcc303:不要洗文.... 03/27 11:11
→ freelysoul:今天有認真上課 上來當個好人 大家以後也要救我嘿 哈 03/27 11:12
→ kcc303:勸你自刪.... 03/27 11:13
→ fire0000:聽說你貼的錯耶 有人說跑不出來= = 03/27 11:41
→ freelysoul:真假 那就算了 不要貼 03/27 11:57