English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2 answers

This is how it would look in c#, which is really really close. The example is a selection sort. I code for a living. I haven't tested this code. Good luck. PLEASE try to understand it before you turn in your assignment. This code would be indented, but yahoo takes out the extra white space.

Lets say that arrayToSort is the name of the array you are going to sort.

for(int a = 1; a < arrayToSort.Length; a++)
for(int b = 0; b < a; b++)
if (arrayToSort[b] > arrayToSort[a])
{
int temp = arrayToSort[b];
arrayToSort[b] = arrayToSort[a];
arrayToSort[a] = temp;
}

2006-08-18 18:54:47 · answer #1 · answered by Michael M 6 · 0 0

http://www.google.nl/search?hl=en&q=sorting+in+c%2B%2B

2006-08-18 18:51:13 · answer #2 · answered by gjmb1960 7 · 0 0

fedest.com, questions and answers