使用QBASIC编程如下。
CLS
OPEN "answer.txt" FOR OUTPUT AS #1
CLOSE #1
OPEN "answer.txt" FOR APPEND AS #1
FOR hongtao = 1 TO 4
fangkuai = 5 - hongtao
heitao = 6 - hongtao
meihua = 13 - hongtao - heitao - fangkuai
PRINT #1, "hongtao="; hongtao; "heitao="; heitao; "fangkuai="; fangkuai; "meihua="; meihua
NEXT hongtao
CLOSE #1
SHELL "NOTEPAD answer.TXT"
END