dim a string open "c:\1.txt" for as append #1 print #1, a + 1 close #1if a + 1 > 10 then msgbox "已经第10次了,所有数据都清零!重新计算!” open "c:\1.txt" for as input #1 print #1,"0" close @1 end if 我只能写成这样子!!!
VB的代码 哈我随便说点: 1. a 是你的变量,你要用他跟10(数字)比较,他不应该是string,应该是integer 2. 你的a是的变量,每运行一次 他都会重新被赋值,(如果是string应该是“”,integer的话 应该是0),所以不管你运行多少次 他都不会告诉你 “已经第十次” 建议写个循环, 好久不写VB了 可能写的不对 for a = 0 to 10 (step 1) // 你的代码 next 3. ...
dim a integer for a = 0 to 10 (step 1) open "c:\1.txt" for as append #1 print #1, a + 1 close #1 if a + 1 > 10 then msgbox "已经第10次了,所有数据都清零!重新计算!” open "c:\1.txt" for as input #1 print #1,"0" close @1 end if next 这样有没有问题?
dim a integer a= a+1 for a = 0 to 10 (step 1) open "c:\1.txt" for as append #1 print #1, a close #1 if a > 10 then msgbox "已经第10次了,所有数据都清零!重新计算!” a = 0 end if next 请高手帮忙改改!!
2 这是第二次……
……
10 这是第十次……先读txt文件,获取前面的数字(用split函数),在这个基础加,写入txt文本,如果10了就提示
dim a string
open "c:\1.txt" for as append #1
print #1, a + 1
close #1if a + 1 > 10 then
msgbox "已经第10次了,所有数据都清零!重新计算!”
open "c:\1.txt" for as input #1
print #1,"0"
close @1
end if 我只能写成这样子!!!
1. a 是你的变量,你要用他跟10(数字)比较,他不应该是string,应该是integer
2. 你的a是的变量,每运行一次 他都会重新被赋值,(如果是string应该是“”,integer的话 应该是0),所以不管你运行多少次 他都不会告诉你 “已经第十次” 建议写个循环, 好久不写VB了 可能写的不对
for a = 0 to 10 (step 1)
// 你的代码
next
3. ...
for a = 0 to 10 (step 1)
open "c:\1.txt" for as append #1
print #1, a + 1
close #1 if a + 1 > 10 then
msgbox "已经第10次了,所有数据都清零!重新计算!”
open "c:\1.txt" for as input #1
print #1,"0"
close @1
end if
next
这样有没有问题?
a= a+1
for a = 0 to 10 (step 1)
open "c:\1.txt" for as append #1
print #1, a
close #1 if a > 10 then
msgbox "已经第10次了,所有数据都清零!重新计算!”
a = 0
end if
next
请高手帮忙改改!!