write a program that accepts dates written in numerical form and then output them as a complete form. for example, the input 2 26 1986 should produce the output: february 26, 1986
Module Module1
Sub Main()
Dim months() = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
Dim day As Integer
Dim monthIndex As Integer
Dim year As Integer
Console.Write("Enter the date in numerical form (Example: 2 26 1986): ")
Dim inputValues() As String = Console.ReadLine().Split(" ")
monthIndex = Integer.Parse(inputValues(0))
If (monthIndex >= 0 And monthIndex < months.Length) Then
day = Integer.Parse(inputValues(1))
year = Integer.Parse(inputValues(2))
Console.WriteLine("{0} {1}, {2}", months(monthIndex - 1), day, year)
Else
Console.WriteLine("Wrong month")
End If
Console.ReadLine()
End Sub
End Module
Comments
Leave a comment