Click here to Skip to main content
15,894,825 members
Home / Discussions / C#
   

C#

 
GeneralEvents -- multithreaded & UI Pin
Arun Bhalla21-Feb-03 15:30
Arun Bhalla21-Feb-03 15:30 
GeneralRe: Events -- multithreaded & UI Pin
leppie21-Feb-03 21:59
leppie21-Feb-03 21:59 
GeneralRe: Events -- multithreaded & UI Pin
Arun Bhalla22-Feb-03 11:39
Arun Bhalla22-Feb-03 11:39 
GeneralRe: Events -- multithreaded & UI Pin
leppie22-Feb-03 12:11
leppie22-Feb-03 12:11 
GeneralResources for game development in C# Pin
sideveloper21-Feb-03 12:59
sideveloper21-Feb-03 12:59 
GeneralRe: Resources for game development in C# Pin
Anonymous21-Feb-03 14:14
Anonymous21-Feb-03 14:14 
GeneralControl clipping issues Pin
m_mond21-Feb-03 10:37
m_mond21-Feb-03 10:37 
GeneralRe: Control clipping issues Pin
Furty21-Feb-03 13:33
Furty21-Feb-03 13:33 
GeneralRe: Control clipping issues Pin
m_mond22-Feb-03 3:59
m_mond22-Feb-03 3:59 
QuestionKeeping select visible when losing focus? Pin
Paul Riley21-Feb-03 10:20
Paul Riley21-Feb-03 10:20 
AnswerRe: Keeping select visible when losing focus? Pin
Furty21-Feb-03 13:46
Furty21-Feb-03 13:46 
QuestionFree grid controls? Pin
Domenic Denicola21-Feb-03 8:57
Domenic Denicola21-Feb-03 8:57 
AnswerRe: Free grid controls? Pin
Nnamdi Onyeyiri21-Feb-03 9:23
Nnamdi Onyeyiri21-Feb-03 9:23 
GeneralOwner Draw Splitter changing background when moving Pin
STW21-Feb-03 5:29
STW21-Feb-03 5:29 
GeneralRe: Owner Draw Splitter changing background when moving Pin
Stephane Rodriguez.21-Feb-03 20:18
Stephane Rodriguez.21-Feb-03 20:18 
GeneralRe: Owner Draw Splitter changing background when moving Pin
STW23-Feb-03 6:51
STW23-Feb-03 6:51 
GeneralRe: Owner Draw Splitter changing background when moving Pin
Stephane Rodriguez.23-Feb-03 7:26
Stephane Rodriguez.23-Feb-03 7:26 
Generalsimple explaination Pin
sacoskun21-Feb-03 4:16
sacoskun21-Feb-03 4:16 
Hi again,
This code is for sorting the numbers which are given randomly in an array.


private void BubbleSort(int[] a) {
for ( int i = 0; i < a.Length - 1; i++ ) {
for ( int j = 0; j < a.Length - i - 1; j++ ) {
if ( a[j] > a[j + 1] ) {
int temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp; }
}
}
}

private void sort_Click(object sender, System.EventArgs e) {
const int count = 1000;
Random r = new Random();

int[] a = new int[count];

for ( int i = 0; i < count; i++ )
a[i] = r.Next(1000); //numbers 0 - 999

BubbleSort(a);

for ( int i = 0; i < count; i++ ) {
richTextBox1.AppendText( a[i].ToString() + " " );
}
}
}

I want to ask why we used the second for loop can't we do it with only one "for loop"?
And why we substracted i(int) in the second loop's condition?

Kind Regards,

-
kromozom@msn.com for MSN Messenger
-
GeneralRe: simple explaination Pin
Atul Kale21-Feb-03 5:15
Atul Kale21-Feb-03 5:15 
GeneralRe: simple explaination Pin
sacoskun21-Feb-03 8:05
sacoskun21-Feb-03 8:05 
GeneralRe: simple explaination Pin
Atul Kale23-Feb-03 5:41
Atul Kale23-Feb-03 5:41 
GeneralRe: simple explaination Pin
sacoskun24-Feb-03 10:27
sacoskun24-Feb-03 10:27 
GeneralString to Binary Pin
Mazdak21-Feb-03 0:57
Mazdak21-Feb-03 0:57 
GeneralRe: String to Binary Pin
Anonymous21-Feb-03 2:03
Anonymous21-Feb-03 2:03 
GeneralRe: String to Binary Pin
leppie21-Feb-03 6:01
leppie21-Feb-03 6:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.