Boolean Swap

Status
Not open for further replies.

HiGuys

New member
Joined
Mar 25, 2008
Messages
4
Location
Aberdeen UK
Programming Experience
Beginner
Can anyone advise me on the coding to use if i want to arrange a list of names into alphabetical order using a boolean swap method many thanks im very new to this language :p
 
can you describe what you mean by "boolean swap"? Do you mean the bubble sort algorithm? Normally, for most practical purposes you just call the Sort() method on a collection which does it for you...
 
swap

im not sure ive got a form n a pupil class in the form im getting the names and marks from a txt file im outputting it to a rich text box with a grade so now i need to sort out the name alphabetically???
 
ok, so what construct are you using to store the names?

Are you using an array (eg, "Dim myNames() As String"),
an ArrayList (eg, "Dim myNames As ArrayList = New ArrayList"),
a "List(Of T)" ( eg, "Dim myNames As List(Of String) = New List(Of String)"),
or a "Dictionary(Of Tkey, Tvalue)" (eg, "Dim myNamse As Dictionary(Of Integer, String) = New Dictionary(Of Integer, String)")?

Whichever the case, it's likely you can use something like "myNames.Sort()" to sort them.
 
Attached

I have attached what i need to do and im stuck stuck stuck :eek:

I need a version 1 for question 1 and a version 2 for question 2
 

Attachments

  • Lab Exercise Week 10.doc
    26 KB · Views: 23
I won't be doing your homework for you :) That said, the easiest way I can see to sort an array is;

'** note: for demonstration purposes, I declared an array called "test"
'** and populated it first before using this code
Dim sortTest As System.Collections.ArrayList sortTest = new System.Collections.ArrayList(test);
sortTest.Sort();
sortTest.CopyTo(test);

'data, array "test" is sorted alphabetically
 
I have attached what i need to do and im stuck stuck stuck :eek:

I need a version 1 for question 1 and a version 2 for question 2

You still haven't answered DiskJunky's question, which is needed before anyone can help you move forward.

Also, we don't do homework for people, we help people with their questions so they can get their homework done
 
Not Homework

Its not homework and ive practically finished it ! i give you specs of what i was doing to c if you could understand what i needed no matter thanks for your help guys i will just keep looking. As i said at beginning im learning it !
All i can say is not a great forum for helping beginners. Ps its not an array sort its using boolean to help swap the initial letter of the secondName so it comes out alphabetically how the hell can i do a sort on a external file like that ????
 
Last edited:
Its not homework and ive practically finished it ! i give you specs of what i was doing to c if you could understand what i needed no matter thanks for your help guys i will just keep looking. As i said at beginning im learning it !
All i can say is not a great forum for helping beginners

I disagree. I was practically a beginner when i started coming here, and everyone here was of immense help. And everyone is thinking this is homework, at least this is my reason for thinking it, because the file you attached is called "Lab Exercise Week 10.doc". That sounds like an assignment to me.
 
'Lab Exercise Week 10' certainly looks like a homework assignment.

In either case, we're not doing the work for you (homework or not) having other people do the work for you isn't learning.

Also you haven't shown us any of the code you're having problem(s) with, you haven't told us how you're doing anything, we don't have a clue what you actually need help with.

Beginner or not, there's nothing for us to help you with other than 'this is the assignment I need to do'

Next time i will rename it???? if i was doing an assessment id be in class not at home duh you guys think what u like this site is rubbish!
You're certainly welcome to find a forum with members who will do your work for you
 
Status
Not open for further replies.
Back
Top