主题:[原创]文件操作
这个程序用来对任意一个进行修改删除预览。
代码如下
CLS
INPUT "Hi!What's your name"; a$
CLS
PRINT "Welcome,"; a$
DO
INPUT "lu jing "; b$
IF b$ = "esc" THEN EXIT DO
DO
GOSUB 100
INPUT "What are you doing"; n
SELECT CASE n
CASE 1
OPEN b$ FOR APPEND AS #1
INPUT "zeng jia nai rong"; c$
WRITE #1, c$
CLS
PRINT "OK"
SLEEP .5
GOSUB 100
CLOSE #1
CASE 2
OPEN b$ FOR OUTPUT AS #1
INPUT "chong xie nei rong"; c$
WRITE #1, c$
CLS
PRINT "OK"
SLEEP .5
GOSUB 100
CLOSE #1
CASE 3
OPEN b$ FOR INPUT AS #1
DO WHILE NOT EOF(1)
INPUT #1, x$
PRINT x$
LOOP
SLEEP .5
CLS
GOSUB 100
CLOSE #1
CASE 4
KILL b$
CLS
PRINT "OK"
SLEEP .5
GOSUB 100
END SELECT
LOOP UNTIL n = 0
LOOP UNTIL b$ = "esc"
CLS
PRINT "Thanks"
END
100
CLS
PRINT "Welcome,"; a$
PRINT "1.zeng jia"
PRINT "2.chongxie"
PRINT "3.yu lan"
PRINT "4.shan chu"
RETURN
怎么样?!
代码如下
CLS
INPUT "Hi!What's your name"; a$
CLS
PRINT "Welcome,"; a$
DO
INPUT "lu jing "; b$
IF b$ = "esc" THEN EXIT DO
DO
GOSUB 100
INPUT "What are you doing"; n
SELECT CASE n
CASE 1
OPEN b$ FOR APPEND AS #1
INPUT "zeng jia nai rong"; c$
WRITE #1, c$
CLS
PRINT "OK"
SLEEP .5
GOSUB 100
CLOSE #1
CASE 2
OPEN b$ FOR OUTPUT AS #1
INPUT "chong xie nei rong"; c$
WRITE #1, c$
CLS
PRINT "OK"
SLEEP .5
GOSUB 100
CLOSE #1
CASE 3
OPEN b$ FOR INPUT AS #1
DO WHILE NOT EOF(1)
INPUT #1, x$
PRINT x$
LOOP
SLEEP .5
CLS
GOSUB 100
CLOSE #1
CASE 4
KILL b$
CLS
PRINT "OK"
SLEEP .5
GOSUB 100
END SELECT
LOOP UNTIL n = 0
LOOP UNTIL b$ = "esc"
CLS
PRINT "Thanks"
END
100
CLS
PRINT "Welcome,"; a$
PRINT "1.zeng jia"
PRINT "2.chongxie"
PRINT "3.yu lan"
PRINT "4.shan chu"
RETURN
怎么样?!