-
Notifications
You must be signed in to change notification settings - Fork 0
/
task 2.VB
34 lines (29 loc) · 888 Bytes
/
task 2.VB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Module Module1
Sub Main()
Dim mychar1, mychar2, mychar3 As Char
Dim mystr1, mystr2 As String
Dim c As Integer
mychar1 = ""
mychar2 = ""
mychar3 = ""
mystr1 = ""
mystr2 = ""
c = 0
Console.Write("PLEASE ENTER STRING: ")
mystr1 = Console.ReadLine
Console.Write("PLEASE ENTER CHARACTER TO REPLACE: ")
mychar1 = Console.ReadLine
Console.Write("PLEASE ENTER SUBSTITUTION CHARACTER: ")
mychar2 = Console.ReadLine
For c = 1 To Len(mystr1)
mychar3 = Mid(mystr1, c, 1)
If mychar3 = mychar1 Then
mystr2 = mystr2 & mychar2
Else
mystr2 = mystr2 & mychar3
End If
Next
Console.WriteLine("resulting string is: " & mystr2)
Console.ReadKey()
End Sub
End Module