看板Programming
標 題簡易統一發票對獎程式
發信站椰林風情 (Tue Mar 27 18:19:54 2012)
轉信站ptt!news.ntu!Palmarama
rem
http://www.facebook.com/pages/Simple-Basic-Programming-Algorithm/210860158955706
rem 101年1、2月統一發票中獎號碼
count=1
number$[count]="59609701"
commet$[count]="特別獎"
count=count+1
number$[count]="07063353"
commet$[count]="特獎"
count=count+1
number$[count]="33640895"
commet$[count]="頭獎"
count=count+1
number$[count]="67996436"
commet$[count]="頭獎"
count=count+1
number$[count]="35573745"
commet$[count]="頭獎"
count=count+1
number$[count]="144"
commet$[count]="增開六獎"
count=count+1
number$[count]="598"
commet$[count]="增開六獎"
100 cls
hit_list=0
input "請輸入尾數號碼",a$
if len(a$)=0 then 500
hit_y[hit_list+1]=0
for y=1 to count
for x=1 to len(a$)
b$=right$(a$,x)
c$=right$(number$[y],x)
if b$=c$ then hit_x[hit_list+1]=x : hit_y[hit_list+1]=y
next
if hit_y[hit_list+1]>0 then hit_list=hit_list+1 : hit_y[hit_list+1]=0
next
i=1
while i<=hit_list
k=hit_y[i]
print "尾數對中",hit_x[i],"碼",commet$[k],number$[k]
if hit_x[i]=8 and commet$[k]="特別獎" then print "特別獎 1000萬元"
if hit_x[i]=8 and commet$[k]="特獎" then print "特獎 200萬元"
if hit_x[i]=8 and commet$[k]="頭獎" then print "頭獎 20萬元"
if hit_x[i]=7 and commet$[k]="頭獎" then print "二獎 4萬元"
if hit_x[i]=6 and commet$[k]="頭獎" then print "三獎 1萬元"
if hit_x[i]=5 and commet$[k]="頭獎" then print "四獎 4千元"
if hit_x[i]=4 and commet$[k]="頭獎" then print "五獎 1千元"
if hit_x[i]=3 and commet$[k]="頭獎" then print "六獎 2百元"
if hit_x[i]=3 and commet$[k]="增開六獎" then print "增開六獎 2百元"
i=i+1
wend
if hit_list=0 then print "沒對中"
print
input "請按任一鍵繼續,按Q退出",d$
if cap$(d$)<>"Q" then 100
500 end
--
☆ [Origin:椰林風情] [From: host-58-115-151-138.dynamic] [Login: **] [Post: **]
1F:→ MOONRAKER:還敢來…不要跑,待我回去電死你 118.163.12.174 03/27 19:04
2F:推 EdisonX:中邪了嗎 ? 180.177.76.161 03/27 19:18
3F:推 ShadowMask:?? 114.27.30.133 03/27 19:58
4F:推 mars90226:題目到底是啥?? 125.226.2.101 03/27 22:00
5F:→ yauhh:其實他沒錯啦,這也叫作programming. 不過, 61.231.71.233 03/27 22:21
6F:→ yauhh:若要稱為algorithm... 唉,不要來鬧. 61.231.71.233 03/27 22:23
7F:→ MOONRAKER:我回來就累啦,也懶得找QB或BASIC 7.0218.160.178.149 03/28 01:13
8F:→ MOONRAKER:誰有空用個read/data電死他吧218.160.178.149 03/28 01:14
9F:→ MOONRAKER:custom type更好 給他點教訓 XD218.160.178.149 03/28 01:14
10F:→ EdisonX:link 廣告嫌疑 ? 180.177.76.161 03/28 09:39
11F:推 yauhh:不要啦,C/P太低180.205.139.107 03/28 10:47