title: C++ Sorting Class Array
body: <p>C++ Sorting Array Class</p>
  
  <p>I have an array object that record the following..</p>
  
  <p>This is at <strong>classone.h</strong> </p>
  
  <pre><code>ClassOne
  {
  string name;
  int data;
  float valueData;
  }
  </code></pre>
  
  <p>and the constructor are created at <strong>classone.cpp</strong></p>
  
  <p>At main.cpp I created ClassOne Array of Size 10</p>
  
  <pre><code>#include "classone.h"
  
  ClassOne cone[10];
  </code></pre>
  
  <p>Next is  i recorded several value to the object </p>
  
  <p>and now ClassOne got 3 objects</p>
  
  <pre><code>cone[0]
  name = "hello"
  data = 1
  valueData = 20
  
  cone[1]
  name = "panda"
  data = 2
  valueData = 15
  
  cone[2]
  name = "joe"
  data = 3
  valueData = 25
  </code></pre>
  
  <p>What i want to achieve is do a sort that can rearrange this array by <strong>valueData</strong> highest ascending form so.. it will be</p>
  
  <p><code>cone[2]</code> then <code>cone[0]</code> then <code>cone[1]</code> ..</p>
  
  <p>but the issue if i use bubble sort , i tried google and find some, they are sorting by e.g  <code>int a[]={9,6,5,23,2,6,2,7,1,8};</code></p>
  
  <p>but i wanna sort by class array object. and re-arrange the value together , how do i achieve this.</p>
  
  <p>So when i cout it will be</p>
  
  <pre><code>-- Highest to lowest --
  1) Name: Joe , Data = 3, Value =25
  2) Name: Hello , Data =1 , Value = 20
  3) Name: Panda, Data = 2, Value = 15
  </code></pre>
  
  <p><strong>Thanks for all help and guide!!</strong></p>