This code doesn't seem to be working. I don't really know what loop to use to get it too add the information the user puts into the machine to print again.
The aim of this is for the user to either pick:
First of all I need to use this array to let the user enter there information into the database. Using an array. However it lets them type things but then I close the program and then it doesn't print it into the database next time I run the program.
1.to print a menu that they have typed in an earlier database. If they haven't typed anything into the database, then it should be blank
2.Do error checking so that it tells them if they have entered a number when they should have entered a letter.
3.To end the program. Here is the code.
Module Module1
Structure Car
Public carmake As String
Public carmodel As String
Public caryear As Integer
Public carlicence As String
End Structure
Sub Main()
Dim userchoice
Console.WriteLine("Choose weather to open the database(1), print it (2) or end (3)")
userchoice = Console.ReadLine()
If userchoice = "1" Then
Dim cardatabase(4) As Car
Console.WriteLine("This will allow you to view the database.")
Console.WriteLine("Please enter the car make,licence,model and year")
cardatabase(1).carmake = Console.ReadLine()
cardatabase(1).carlicence = Console.ReadLine()
cardatabase(1).carmodel = Console.ReadLine()
cardatabase(1).caryear = Console.ReadLine()
ElseIf userchoice = "2" Then
Console.WriteLine("The database is,")
ElseIf userchoice = "3" Then
Console.WriteLine("Thanks for using this program.")
End If
Console.ReadLine()
End Sub
End Module
Aucun commentaire:
Enregistrer un commentaire