From 1d879cb17202f7472664ef01bff428ece44f9840 Mon Sep 17 00:00:00 2001 From: ptt Date: Mon, 28 Jun 2004 20:41:54 +0000 Subject: large int avoid overflow git-svn-id: http://opensvn.csie.org/pttbbs/branches/ptt.fpg@2097 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/merge.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/merge.c b/mbbsd/merge.c index 8507a219..d141bb02 100644 --- a/mbbsd/merge.c +++ b/mbbsd/merge.c @@ -73,13 +73,12 @@ m_fpg() clrtobot(); #ifdef MERGEMONEY int price[10] = {74, 21, 29, 48, 67, 11, 9, 43, 57, 72}; - unsigned int market[10], lmarket; + unsigned int market[10], lmarket=0; reload_money(); - lmarket=0; for(i=0; i<10; i++) - lmarket += market[i]/674 *price[i]; + lmarket += market[i]/(674 / price[i]); sprintf(buf, "您的花園幣有 %10d 換算成 Ptt 幣為 %9d (優惠匯率 155:1), \n" " 銀行有 %10d 換算為 Ptt 幣為 %9d (匯率為 674:1), \n" -- cgit v1.2.3