title: Trying to sort struct but it isnt working?
body: <p>The function is supposed to sort the users by their total money from their deposits but it ain't working properly, I am sure that it is not from the variables as it is still displaying what it needs to but not sorted, where am I wrong?</p>
  <pre><code>    
      for(int i = 0; i &lt; *br; i++)
      for(int j = 0; j &lt; l[i].numofdep; j++)l[i].total += l[i].dep[j].value;
      
      for(int i = 0; i &lt; *br - 1; i++)
      for(int j = 0; j &lt; *br - 1; j++)
      {
          if(l[j].total &gt; l[j+1].total)
          {
              int in = l[j].no;
              l[j].no = l[j+1].no;
              l[j+1].no = in;
              
              string str = l[j].fname;
              l[j].fname = l[j+1].fname;
              l[j+1].fname = str;
              
              str = l[j].lname;
              l[j].lname = l[j+1].lname;
              l[j+1].lname = str;
              
              in = l[j].numofdep;
              l[j].numofdep = l[j+1].numofdep;
              l[j+1].numofdep = in;
              
              for(int k = 0; k &lt; l[i+1].numofdep; k++)
              {
                  in = l[j].dep[k].value;
                  l[j].dep[k].value = l[j+1].dep[k].value;
                  l[j+1].dep[k].value = in;
                  
                  str = l[j].dep[k].currency;
                  l[j].dep[k].currency = l[j+1].dep[k].currency;
                  l[j+1].dep[k].currency = str;
                  
                  in = l[j].dep[k].dd;
                  l[j].dep[k].dd = l[j+1].dep[k].dd;
                  l[j+1].dep[k].dd = in;
                  
                  in = l[j].dep[k].mm;
                  l[j].dep[k].mm = l[j+1].dep[k].mm;
                  l[j+1].dep[k].mm = in;
                  
                  in = l[j].dep[k].yy;
                  l[j].dep[k].yy = l[j+1].dep[k].yy;
                  l[j+1].dep[k].yy = in;
              }
          }
      }
  </code></pre>