title: Bubble sort, Selection sort, and insertion sort
body: <p><a href="http://imgur.com/TnUACAc" rel="nofollow">http://imgur.com/TnUACAc</a></p>
  
  <p>This is the link that shows the result.</p>
  
  <p>And this result is how my result of C++ must be like</p>
  
  <p>As this result shows, there are Bubble sort, Selection Sort, and Insertion Sort,</p>
  
  <p>and every process of each sort is shown to the black screen.</p>
  
  <p>For example, (Bubble Sort)</p>
  
  <p>20     10     40     30</p>
  
  <p>20     10     30     40</p>
  
  <p>10     20     30     40.</p>
  
  <p>I have to use <code>void displayPtrArray</code> to show like that.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;array&gt;
  #include &lt;iomanip&gt;
  
  using namespace std;
  
  void reset(int array[], const int size);
  void displayIntArray();
  void displayPtrArray(const int array[], int size);
  void BubbleSort(int array[], int size);
  void SelectionSort(int array[], int size);
  void InsertionSort(int a[], int size);
  
  const int RR = 4;
  
  int main()
  {
      int arr[RR];
      reset(arr, RR);
  
  }
  
  void reset(int array[], const int size)
  {
      cout &lt;&lt; "The originial array has been reset to:" &lt;&lt; endl;
      int array[RR] = { 20, 40, 10, 30 };
  
      for (int n = 0; n &lt; size; n++)
      {
          cout &lt;&lt; setw(5) &lt;&lt; array[n];
      }
      cout &lt;&lt; endl &lt;&lt; endl;
  }
  
  void displayPtrArray(const int array[], int size)
  {
  }
  
  void displayIntArray()
  {
  }
  
  void BubbleSort(int array[], int size)
  {
      bool swap;
      int temp;
  
      do
      {
          swap = false;
          for (int count = 0; count &lt; (size - 1); count++)
          {
              if (array[count] &gt; array[count + 1])
              {
                  temp = array[count];
                  array[count] = array[count + 1];
                  array[count + 1] = temp;
                  swap = true;
              }
          }
      } while (swap);
  }
  
  void selectionSort(int array[], int size)
  {
      int startScan, minIndex, minValue;
  
      for (startScan = 0; startScan &lt; (size - 1); startScan++)
      {
          minIndex = startScan;
          minValue = array[startScan];
          for (int index = startScan + 1; index &lt; size; index++)
          {
              if (array[index] &lt; minValue)
              {
                  minValue = array[index];
                  minIndex = index;
              }
          }
          array[minIndex] = array[startScan];
          array[startScan] = minValue;
      }
  }
  
  void InsertionSort(int a[], int size)
  {
      for (int i = 1; i&lt;size; i++)
      {
          int j;
          int current = a[i];
          for (j = i - 1; j &gt;= 0 &amp;&amp; a[j]&gt; current; j--)
          {
              a[j + 1] = a[j];
          }
          a[j + 1] = current;
      }
  }
  </code></pre>
  
  <p>I use the function for every sort, but if that is wrong please tell me.</p>
  
  <p>And teach me how to show the process of each sort with </p>
  
  <pre><code>void displayPtrArray
  </code></pre>
  
  <p>I really don't know..... T_T...........</p>
  
  <p>PLEASE HELP !!</p>