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 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) Should let the user enter ifnormation into the databse (What I am mostly strugglign with) and do error checking so that it tells them if they have entered a number when they shoiuld have entereed a letter and 3) To end the program. When I do 2) It lets me type but it doesnt recall the infomation back in the database. Also it needs a number 4) which should return to the main menu. Which i think is where the loops come in but i dont know which one to use Here is the code:
Structure Cars
Public carmake As String
Public carmodel As String
Public caryear As Integer
Public carlicence As String
End Structure Module Module1
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 Cars
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
Aucun commentaire:
Enregistrer un commentaire