主题:知道有错却不知错在哪 !解决30分
学习了不少时间的qb 总是不进步 别人看来很简单的我却没办法 下面的问题 希望有知道的不嫌麻烦告诉我 !
我的程序想解决的问题 从一个文件读出任意一组数据并完整写出来
只所以用seek 是希望从任意一期读入都可以正确的显示
发现问题
在程序的这里
s1 = 56
SEEK #6, s1 * 10
这里的10是代表从第10期数据读入,问题就在这里 如果10换了8以下都是对的 ,换了比8大的print出来的顺序就错了 求指正错在那里了 为什么 只求改正这个错误的原因 不求其他方法 因为想知道错在那里了 还有就是再深的还不会!
下面是程序
OPEN "f:c04.txt" FOR INPUT AS #6
s1 = 56
' SEEK #6, s1 * 1
FOR i = 1 TO 1
INPUT #6, a12, a11, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
ax(a1) = ax(a1) + 1
ax(a2) = ax(a2) + 1
ax(a3) = ax(a3) + 1
ax(a4) = ax(a4) + 1
ax(a5) = ax(a5) + 1
ax(a6) = ax(a6) + 1
ax(a7) = ax(a7) + 1
s1 = 56
SEEK #6, s1 * 10 FOR i1 = 1 TO 14
INPUT #6, b12, b11, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10
NEXT i1
PRINT b12; b11; b1; b2; b3; b4; b5; b6; b7; b8; b9; b10
FOR j = 0 TO 35
ax(j) = 0
ax1(j) = 0
tj(j) = 0
FOR j1 = 0 TO 15
bx(j, j1) = 0
cx(j, j1) = 0
dx(j, j1) = 0
tj1(j, j1) = 0
NEXT j1
NEXT j
qq1 = 0
qq2 = 0
qq3 = 0
qq4 = 0
qq8 = 0
NEXT i
PRINT q
CLOSE
END
下面是 c04.txt 文件
2009044 2009-06-08 08 13 20 23 24 29 33 35 0 0
2009043 2009-06-05 04 09 15 27 29 31 33 34 0 0
2009042 2009-06-01 03 17 18 19 21 27 35 28 0 0
2009041 2009-05-29 07 09 12 13 17 24 35 18 0 6
2009040 2009-05-25 04 05 13 28 32 33 34 21 0 0
2009039 2009-05-22 01 06 10 17 19 21 22 30 0 0
2009038 2009-05-18 03 04 06 10 15 20 25 27 0 0
2009037 2009-05-15 01 07 11 26 28 30 32 05 0 1
2009036 2009-05-11 05 08 26 29 31 33 34 03 0 0
2009035 2009-05-08 05 08 10 18 25 28 32 09 0 0
2009034 2009-05-04 02 14 15 16 23 32 34 27 0 0
2009033 2009-05-01 04 06 10 18 22 24 25 14 0 0
2009032 2009-04-27 05 15 22 23 27 28 29 32 0 1
2009031 2009-04-24 03 09 13 20 21 28 35 19 0 1
2009030 2009-04-20 05 08 11 18 26 30 33 13 0 0
2009029 2009-04-17 02 06 10 19 21 23 24 16 0 0
2009028 2009-04-13 04 05 07 18 27 30 33 25 0 0
2009027 2009-04-10 01 14 20 28 29 32 34 04 0 0
2009026 2009-04-06 04 16 21 22 23 24 33 32 0 0
2009025 2009-04-03 12 14 19 23 26 31 33 15 0 0
2009024 2009-03-30 02 04 10 12 18 21 33 17 0 0
2009023 2009-03-27 01 07 13 14 20 27 33 30 0 0
2009022 2009-03-23 02 03 04 08 09 24 29 20 0 1
2009021 2009-03-20 07 13 15 17 26 31 32 19 0 0
2009020 2009-03-16 05 14 18 24 26 31 32 11 0 0
2009019 2009-03-13 15 17 23 25 26 28 30 22 0 0
2009018 2009-03-09 01 02 04 06 18 27 34 23 0 0
2009017 2009-03-06 02 03 19 26 27 33 34 05 0 0
2009016 2009-03-02 01 04 08 10 24 25 33 22 0 0
2009015 2009-02-27 04 10 12 30 31 33 34 11 0 0
2009014 2009-02-23 05 11 16 18 25 26 33 03 0 0
2009013 2009-02-20 07 09 17 22 30 32 33 10 0 0
2009012 2009-02-16 01 06 16 18 20 25 31 12 0 0
2009011 2009-02-13 01 08 11 16 17 29 34 24 0 0
2009010 2009-02-09 01 04 10 11 16 20 23 17 0 0
2009009 2009-02-06 06 07 08 11 13 26 33 22 0 0
2009008 2009-02-02 03 05 17 18 24 31 33 21 0 1
2009007 2009-01-23 06 10 11 12 13 21 33 01 0 0
2009006 2009-01-19 01 06 11 13 22 28 35 27 0 0
2009005 2009-01-16 01 03 08 12 13 15 26 27 0 0
2009004 2009-01-12 11 12 13 16 18 20 25 22 0 0
2009003 2009-01-09 04 12 15 16 25 29 32 13 0 0
2009002 2009-01-05 06 11 20 26 28 31 32 17 0 1
2009001 2009-01-02 03 06 17 21 24 34 35 27 0 0
我的程序想解决的问题 从一个文件读出任意一组数据并完整写出来
只所以用seek 是希望从任意一期读入都可以正确的显示
发现问题
在程序的这里
s1 = 56
SEEK #6, s1 * 10
这里的10是代表从第10期数据读入,问题就在这里 如果10换了8以下都是对的 ,换了比8大的print出来的顺序就错了 求指正错在那里了 为什么 只求改正这个错误的原因 不求其他方法 因为想知道错在那里了 还有就是再深的还不会!
下面是程序
OPEN "f:c04.txt" FOR INPUT AS #6
s1 = 56
' SEEK #6, s1 * 1
FOR i = 1 TO 1
INPUT #6, a12, a11, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
ax(a1) = ax(a1) + 1
ax(a2) = ax(a2) + 1
ax(a3) = ax(a3) + 1
ax(a4) = ax(a4) + 1
ax(a5) = ax(a5) + 1
ax(a6) = ax(a6) + 1
ax(a7) = ax(a7) + 1
s1 = 56
SEEK #6, s1 * 10 FOR i1 = 1 TO 14
INPUT #6, b12, b11, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10
NEXT i1
PRINT b12; b11; b1; b2; b3; b4; b5; b6; b7; b8; b9; b10
FOR j = 0 TO 35
ax(j) = 0
ax1(j) = 0
tj(j) = 0
FOR j1 = 0 TO 15
bx(j, j1) = 0
cx(j, j1) = 0
dx(j, j1) = 0
tj1(j, j1) = 0
NEXT j1
NEXT j
qq1 = 0
qq2 = 0
qq3 = 0
qq4 = 0
qq8 = 0
NEXT i
PRINT q
CLOSE
END
下面是 c04.txt 文件
2009044 2009-06-08 08 13 20 23 24 29 33 35 0 0
2009043 2009-06-05 04 09 15 27 29 31 33 34 0 0
2009042 2009-06-01 03 17 18 19 21 27 35 28 0 0
2009041 2009-05-29 07 09 12 13 17 24 35 18 0 6
2009040 2009-05-25 04 05 13 28 32 33 34 21 0 0
2009039 2009-05-22 01 06 10 17 19 21 22 30 0 0
2009038 2009-05-18 03 04 06 10 15 20 25 27 0 0
2009037 2009-05-15 01 07 11 26 28 30 32 05 0 1
2009036 2009-05-11 05 08 26 29 31 33 34 03 0 0
2009035 2009-05-08 05 08 10 18 25 28 32 09 0 0
2009034 2009-05-04 02 14 15 16 23 32 34 27 0 0
2009033 2009-05-01 04 06 10 18 22 24 25 14 0 0
2009032 2009-04-27 05 15 22 23 27 28 29 32 0 1
2009031 2009-04-24 03 09 13 20 21 28 35 19 0 1
2009030 2009-04-20 05 08 11 18 26 30 33 13 0 0
2009029 2009-04-17 02 06 10 19 21 23 24 16 0 0
2009028 2009-04-13 04 05 07 18 27 30 33 25 0 0
2009027 2009-04-10 01 14 20 28 29 32 34 04 0 0
2009026 2009-04-06 04 16 21 22 23 24 33 32 0 0
2009025 2009-04-03 12 14 19 23 26 31 33 15 0 0
2009024 2009-03-30 02 04 10 12 18 21 33 17 0 0
2009023 2009-03-27 01 07 13 14 20 27 33 30 0 0
2009022 2009-03-23 02 03 04 08 09 24 29 20 0 1
2009021 2009-03-20 07 13 15 17 26 31 32 19 0 0
2009020 2009-03-16 05 14 18 24 26 31 32 11 0 0
2009019 2009-03-13 15 17 23 25 26 28 30 22 0 0
2009018 2009-03-09 01 02 04 06 18 27 34 23 0 0
2009017 2009-03-06 02 03 19 26 27 33 34 05 0 0
2009016 2009-03-02 01 04 08 10 24 25 33 22 0 0
2009015 2009-02-27 04 10 12 30 31 33 34 11 0 0
2009014 2009-02-23 05 11 16 18 25 26 33 03 0 0
2009013 2009-02-20 07 09 17 22 30 32 33 10 0 0
2009012 2009-02-16 01 06 16 18 20 25 31 12 0 0
2009011 2009-02-13 01 08 11 16 17 29 34 24 0 0
2009010 2009-02-09 01 04 10 11 16 20 23 17 0 0
2009009 2009-02-06 06 07 08 11 13 26 33 22 0 0
2009008 2009-02-02 03 05 17 18 24 31 33 21 0 1
2009007 2009-01-23 06 10 11 12 13 21 33 01 0 0
2009006 2009-01-19 01 06 11 13 22 28 35 27 0 0
2009005 2009-01-16 01 03 08 12 13 15 26 27 0 0
2009004 2009-01-12 11 12 13 16 18 20 25 22 0 0
2009003 2009-01-09 04 12 15 16 25 29 32 13 0 0
2009002 2009-01-05 06 11 20 26 28 31 32 17 0 1
2009001 2009-01-02 03 06 17 21 24 34 35 27 0 0