I clearly stated that I don't want him to steal the code! The purpose of my post was to show that Google is the first stop when seeking help. Read my second post on here.
I don't learn a thing from my professor because he barely speaks English. That is why I ask questions on here and search for the references on Google. I look at how other people write the code then I figure out the mechanics behind the code and then write it out on my own. There is absolutely nothing wrong with looking at an example to better understand a new concept. That link I sent was how I learned the basics of a bubblesort but if you look at my code below you will see that I made it mine.
It may not be perfect, but it sure as hell is not plagiarism!
Code:
void bubble_Sort(int sort_Array[], int array_Size)
{
bool swap_Flag = true;
int pass = 0;
while (pass<array_Size && swap_Flag)
{
printf ("\n");
if (pass > 0 )
{
printf ("Pass number %d rendered ", pass);
for (int i=0;i<array_Size;i++)
{
printf ("|%d| ", sort_Array[i]);
}
}
swap_Flag = false;
pass++;
for (int i=0;i<array_Size-pass;i++)
{
if (sort_Array[i] > sort_Array[i + 1])
{
int temp = sort_Array[i];
sort_Array[i] = sort_Array[i + 1];
sort_Array[i + 1] = temp;
swap_Flag = true;
}
}
}
if (pass==1)
{
printf ("The array is already sorted!");
}
else
{
printf ("\n");
printf ("\n");
system ("pause");
system ("cls");
printf ("Sorted array: ");
output_Array(sort_Array, array_Size);
printf ("\n");
printf ("\nTotal passes: %d", pass);
}
}
P.S. Don't copy my homework.