请大牛帮忙编写一段VB小代码。有分

请大牛帮忙编写一段VB小代码。有分,第1张

添加一个按钮,然后粘贴代码,路径根据自己需要去改

Option Explicit

Private Sub Command1_Click()

Open "c:\1.txt" For Input As #1

Open "c:\2.txt" For Output As #2

Dim n() As Integer

Dim c As Integer

Dim s As String

While Not EOF(1)

ReDim Preserve n(0 To c) As Integer

Line Input #1, s

n(c) = Val(s)

c = c + 1

Wend

Dim i As Integer, j As Integer

Dim Wait As Integer

Dim cc As Integer

Wait = -1

For i = 0 To c - 1

If n(i) Mod 10 = 0 Then

Wait = i

cc = 0

End If

If Wait = -1 Then

Print #2, Trim(Str(n(i)))

Else

If n(Wait + cc) = n(i) Then

cc = cc + 1

If cc = 10 Then

Print #2, Trim(Str(n(Wait) \ 10))

Wait = -1

cc = 0

End If

Else

For j = Wait To i

Print #2, Trim(Str(n(j)))

Next j

End If

End If

Next i

If Wait <>-1 Then

For j = Wait To i - 1

Print #2, Trim(Str(n(j)))

Next j

End If

Close #1

Close #2

End Sub

定义的时候写成了inflie

主程序中写成了infile看到没。

而且你这程序应该还不止一个错误吧

我编译的结果

E:\practise\Account\main.cpp||In constructor 'COPY_FILE::COPY_FILE()':|

|error: 'nocreate' is not a member of 'std::ios'|

error: 'abort' was not declared in this scope|

error: 'noreplace' is not a member of 'std::ios'|

error: 'abort' was not declared in this scope|

||=== Build finished: 4 errors, 0 warnings ===|


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8128730.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-13
下一篇 2023-04-13

发表评论

登录后才能评论

评论列表(0条)

保存