Bubble sort exercise problem

Hello :)

Can somebody help me in writing a code, which arranges the letters in a word (for example "Hello"), if the letters are being typed in wrong order ("lleho" for example). Thank you in advance. I would be thankful if someone could help me until tomorrow evening, because I have to hand in my homework and I have no idea how to complete this task :) Thanks
Smileys make everything better :)
What you are looking for is an Anagram algorithm. Sorting will do no good here.
Look up the algorithm on Google
@Smac89: My task for the homework is to use the bubble sort.
Sorry I didn't mean there was no need for sorting. Solving anagrams requires some sort of sorting. You can decide to sort the 2 strings to determine if they are equal. Or you can simply count the number of occurrences of each letter in each string and compare that to see if the 2 strings match.

From what I understand of your assignment, you are to get some input from the user and the program will then re-arrange the letters of the word in order to form another word? Well this means your program will require some sort of reference for reordering this word (a dictionary). I don't know of any sorting algorithm that will sort a sequence of letters into an actual word; so all that is left is getting lucky with shuffling the word or using all permutations of the word. But in the end you are still going to have to have a reference of words which your program can use as reference
+1 Smac89

Is it an assignment where you just are checking against a couple words, or is this something where you will be doing, for example, a spell check of an entire human language? There's a huge difference in the way you'll go about this.
@Smac89 , BlakeK : This is the full tex of the assignment task:

Write a program that applies the sorting algorithm „bubble sort“ (http://en.wikipedia.org/wiki/Bubble_sort) to a given array of characters: char string[8] = {'W','E','E','K','E','N','D', 0}; Print the sorted array to the screen.

Note: variables of type char may be used as integers (‘A’ => 65)
Then why didn't you start your topic by stating exactly this? Instead of this:

Emilov wrote:
...writing a code, which arranges the letters in a word (for example "Hello"), if the letters are being typed in wrong order ("lleho" for example).

Well now that that's sorted (no pun) out, what have your tried?
Topic archived. No new replies allowed.