看板Programming
標 題101年1、2月統一發票兌獎
發信站椰林風情 (Tue Mar 27 10:31:43 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]="增開六獎"
count=count+1
100 cls
input "請輸入尾數號碼",a$
if len(a$)=0 then 500
hit_y=0
for x=1 to len(a$)
b$=right$(a$,x)
for y=1 to count
c$=right$(number$[y],x)
if b$=c$ then hit_x=x : hit_y=y
next
next
if hit_y>0 then print "尾數對中",hit_x,"碼",commet$[hit_y],number$[hit_y] else print "沒對中"
if hit_y>0 and hit_x=8 and commet$[hit_y]="特別獎" then print "特別獎 1000萬元"
if hit_y>0 and hit_x=8 and commet$[hit_y]="特獎" then print "特獎 200萬元"
if hit_y>0 and hit_x=8 and commet$[hit_y]="頭獎" then print "頭獎 20萬元"
if hit_y>0 and hit_x=7 and commet$[hit_y]="頭獎" then print "二獎 4萬元"
if hit_y>0 and hit_x=6 and commet$[hit_y]="頭獎" then print "三獎 1萬元"
if hit_y>0 and hit_x=5 and commet$[hit_y]="頭獎" then print "四獎 4千元"
if hit_y>0 and hit_x=4 and commet$[hit_y]="頭獎" then print "五獎 1千元"
if hit_y>0 and hit_x=3 and commet$[hit_y]="頭獎" then print "六獎 2百元"
if hit_y>0 and hit_x=3 and commet$[hit_y]="增開六獎" then print "增開六獎 2百元"
print
input "請按任一鍵繼續,按Q退出",d$
if cap$(d$)<>"Q" then 100
500 end
--
☆ [Origin:椰林風情] [From: host-58-115-151-138.dynamic] [Login: **] [Post: **]
1F:→ MOONRAKER:都寫這種老掉牙BASIC 為何不用data/read 118.163.12.174 03/27 11:39
2F:→ MOONRAKER:就算合成個大字串也好 看得我覽趴攏火 118.163.12.174 03/27 11:39
3F:→ MOONRAKER:底下的if連發也是不知所云,完全失去前 118.163.12.174 03/27 11:40
4F:→ MOONRAKER:面建陣列的意義。這是不是30年前的新手 118.163.12.174 03/27 11:41
5F:→ MOONRAKER:經過時光隧道發過來的? 118.163.12.174 03/27 11:41
6F:→ ShadowMask:囧 114.27.30.133 03/27 12:01
7F:→ MOONRAKER:好吧30年前每行都要行號,那20年吧… 118.163.12.174 03/27 14:53
8F:推 yauhh:我的媽,沒中獎的還要一筆筆輸入... 49.214.66.64 03/27 16:46
9F:推 yoco315:這……我十七年前 T_T 好懷念...182.235.170.158 03/28 10:09
10F:→ yoco315:眼淚快掉下來惹 /_\182.235.170.158 03/28 10:09
11F:推 s3748679:忽然八卦起來.. 想知道十七年前是.. 218.164.80.184 04/02 01:09
12F:→ s3748679:有什麼事呀@@... 218.164.80.184 04/02 01:10