-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathASSIGNMENT2E.vb
More file actions
27 lines (25 loc) · 865 Bytes
/
ASSIGNMENT2E.vb
File metadata and controls
27 lines (25 loc) · 865 Bytes
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
Module Module1
Sub Main()
Dim s, beforeNot, afterBad, finalSentence As String
Dim locationNot, locationBad As Integer
s = " "
beforeNot = " "
afterBad = " "
finalSentence = " "
locationNot = 0
locationBad = 0
Console.WriteLine("Enter the sentence: ")
s = Console.ReadLine
locationNot = InStr(s, "not")
locationBad = InStr(s, "bad")
If locationBad > locationNot Then
beforeNot = Left(s, locationNot - 1)
afterBad = Mid(s, locationBad + 3, Len(s))
finalSentence = beforeNot & "good" & afterBad
Console.Write("The final sentence is: " & finalSentence)
Else
Console.Write("Re enter the sentence")
End If
Console.ReadKey()
End Sub
End Module