This is with microsoft studio visual basic Sorted Names Design a program that al
ID: 3862405 • Letter: T
Question
This is with microsoft studio visual basicSorted Names Design a program that allows the user to enter 20 names into a String array. Sort the array in ascending (alphabetical) order and display its contents. This is with microsoft studio visual basic
Sorted Names Design a program that allows the user to enter 20 names into a String array. Sort the array in ascending (alphabetical) order and display its contents.
Sorted Names Design a program that allows the user to enter 20 names into a String array. Sort the array in ascending (alphabetical) order and display its contents.
Explanation / Answer
Dim string Names (20)
Dim String Name
Declare integer i
Declare integer j
For i = 1 to 20
Display “Input a Name”
Input Name
Set Names(i) = Name
End For
‘Sorting the array ascending ‘
For ( i = 20; i > = 1; I - -)
For (j = 0; j < I; j + +)
If Names(j) > Names (j + 1)
swap (Names(j), Names[j + 1])
End If
End For
End For
‘Displaying name in array ‘
For i = 1 to 20
Display Names(i)
End For
End Prog
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.