CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Feb 2012
    Posts
    2

    [Help] Visula Basic Loops

    I have been trying to figure out a problem for one of my assignments and I got completely stuck. I need to make a program that asks a user for 6 names. After the final name gets entered the program should display 2 names in alphabetical order the highest first the lowest second. Here is what I got so far:
    Code:
    Module Module1
        Const MAX_Names = 6
    
        Sub Main()
    
            Dim name, highName, lowName As String
            Dim count As Integer
    
            count = 0
    
            Console.WriteLine("Enter the name: ")
            name = Console.ReadLine()
    
            Do While count = MAX_Names
                
                If name < lowName Then
                    lowName = name
                ElseIf name > highName Then
                    highName = name
                End If
            Loop
    
            Console.WriteLine("Low name is: " & lowName)
            Console.WriteLine("Low name is: " & highName)
        End Sub
        
    End Module
    If you can help me out or at least point me in a right direction I would really appreciate it. Thank you.
    Last edited by Cimperiali; February 20th, 2012 at 08:26 AM. Reason: added [code][/code] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured