0
我有這段代碼可以找到一些輸入值的平均值和標準偏差。但這是一個靜態程序。我想通過一個MySQL數據庫來使用它。你能幫我嗎?C程序通過mysql pull
int main[] [ /* 2-dimensional array is used to store the height,lenght and the width attributes of the nose. indian array represents the indian data and the china array represents the chinese data */ /* Mean variable represents the mean values. The subscripts are used to identify indian and chinese attributes */ float indian[MAX][3],china[MAX] [3],mean_ih=0,mean_il=0,mean_iw=0,mean_ch=0,mean_cl=0,mean_cw=0; /* Following float variables store the standard deviation values */ float sd_ih=0,sd_il=0,sd_iw=0,sd_ch=0,sd_cl=0,sd_cw=0; int i,j; float test_h,test_l,test_w;
/*填充印度DATABASE */
indian[i][j]=random[]/DIV;
/填充中文數據庫/
china[i][j]=random[]/DIS;
尋找印度和中國數據
的平均mean_ih+=indian[i][0]; mean_il+=indian[i][1]; mean_iw+=indian[i][2]; mean_ch+=china[i][0]; mean_cl+=china[i][1]; mean_cw+=china[i][2]; mean_ih=mean_ih/MAX; mean_il=mean_il/MAX; mean_iw=mean_iw/MAX; mean_ch=mean_ch/MAX; mean_cl=mean_cl/MAX; mean_cw=mean_cw/MAX;
要查找條目
sd_ih+=pow[[indian[i][0]-mean_ih],2]; sd_il+=pow[[indian[i][1]-mean_il],2]; sd_iw+=pow[[indian[i][2]-mean_iw],2]; sd_ch+=pow[[china[i][0]-mean_ch],2]; sd_cl+=pow[[china[i][1]-mean_cl],2]; sd_cw+=pow[[china[i][2]-mean_cw],2]; sd_ih=sqrt[sd_ih/MAX]; sd_il=sqrt[sd_il/MAX]; sd_iw=sqrt[sd_iw/MAX]; sd_ch=sqrt[sd_ch/MAX]; sd_cl=sqrt[sd_cl/MAX]; sd_cw=sqrt[sd_cw/MAX];
提示用戶輸入數據的標準偏差,以驗證
的printf [」 \ n ================ ============================================ \ n「]; printf [「\ n輸入高度\ n」]; scanf [「%f」,&test_h]; printf [「\ n ============================================ ================ \ n「]; printf [「\ n輸入長度\ n」]; scanf [「%f」,&test_l]; printf [「\ n ============================================ ================ \ n「]; printf [「\ n輸入寬度\ n」]; scanf [「%f」,&test_w]; printf [「\ n ============================================ ================ \ n「]; if [[abs [mean_ih-test_h]
爲什麼所有的大括號和圓括號都變成了代碼段中的括號? – JeremyP