[問題] 結構的回圈要如何寫?
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VS2005
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
無
問題(Question):
在Debug模式下:
只計算一次時(i=0)不會有問題但i>1時就會出現
Run-Time Check Failure #2- Stack around the variable "a6" was corrupted
在Release模式下:
沒有任何問題
最後計算值是正確的(試了很多次)
錯誤結果(Wrong Output):
只有在Debug下才有錯誤報告
程式碼(Code):(請善用置底文網頁, 記得排版)
//定一組結構
typedef struct { // LLdouble216
...............(略)..................
} LLdouble216;
//定一組函數
void LLdDvd_APPT_Dev(LLdouble216 a1,LLdouble216 a2,LLdouble216 &b1){
short int i;
int k=0;
LLdouble216 a1e=a1,a2e=a2,a21,a22,a3,x,a4,a5,a6,a7;
a4=LLd_One;
a5=LLd_One;
a6=LLd_One;
F1(a2e,a21);F2(a2e,a22); //得到a21,a22
LLdDvd_APP_Dev(a1,a21,a3); //得到a3
LLdDvd_APP_Dev(a22,a21,x); //得到x
for(i=0;i<4;i++){//逼近次數 //就是這裡有問題
如果改成i<1程式可以跑過
LLdMly(a4,x,a6);
LLdAdd(a5,a6,a7);
a5=a7;
a4=a6;
}
LLdMly(a5,a3,b1);
}
int main(void){ //只執行一個函數
LLdouble216 LD1,LD2,LD3;
LD1=LLd_One;
LD1=LLd_One;
LLdDvd_APPT_Dev(LD1,LD2,LD3);
return 1;
}
--
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.63.132
※ 編輯: wope 來自: 140.112.63.132 (06/25 08:27)
推
06/25 08:32, , 1F
06/25 08:32, 1F
→
06/25 08:33, , 2F
06/25 08:33, 2F
→
06/25 09:18, , 3F
06/25 09:18, 3F
→
06/25 09:19, , 4F
06/25 09:19, 4F
→
06/25 09:26, , 5F
06/25 09:26, 5F
推
06/25 19:37, , 6F
06/25 19:37, 6F
→
06/25 19:37, , 7F
06/25 19:37, 7F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章