sum of three numbers
<p>I have an exercise to do for my university: </p>

<blockquote>
  <p>Find the largest sum of three consecutive numbers  and show matching
  to the number of characters in the order in which they were
  numbers.<br> Input: <br> • 1st line - an integer that is a number of
  sequences<br> • Each sequence is composed of two lines:<br>
      ◘1st contains doubles separated with space. 0 in the end means the end of the line.<br>
      ◘2nd contains characters separated with space, that match numbers from the 1st line.<br> Output: Shows in lines (number of lines=number
  of sequences) 3 characters separated with space that match 3 biggest
  numbers in a row. Example: <br><br> Input:<br> 3<br>
  403.94 324.78 126.09 557.93 257.52 409.61 191.39 235.86 879.98 199.36 924.13 266.84 895.51 783.41 0.00<br> X F T Z L W H E U R T I L D <br>
  838.21 175.43 817.30 162.98 0.00<br> O V T V <br>
  34.63 347.63 522.50 337.02 614.48 0.00<br> U Z L C S <br><br> Output:<br> T I L <br> O V T <br> L C S <br><br></p>
</blockquote>

<p>Here is my code (but it doesn't work):<br></p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;

int main()
{
    double suma, temp, a;
    int l, licznik;
    vector&lt;double&gt; v;
    char ch;
    string u;
    cin&gt;&gt;l;
    for(int i=0;i&lt;l;i++)
    {       
            a=1;
            while(a!=0)
            {
                       cin&gt;&gt;a;
                       v.push_back(a);
            }
            for(int k=0;k&lt;v.size()-1;k++)
            {
                    cin&gt;&gt;ch;
                    u.push_back(ch);
            }
            suma=v[0]+v[1]+v[2];
            for(int j=0;j&lt;(v.size()-2);j++)
            {
                      temp=v[0+j]+v[1+j]+v[2+j];  
                      if(temp&gt;suma)
                      {
                                   suma=temp;
                                   licznik=j;
                      }
            }               
            cout&lt;&lt;u[licznik]&lt;&lt;" "&lt;&lt;u[licznik+1]&lt;&lt;" "&lt;&lt;u[licznik+2]&lt;&lt;" "&lt;&lt;endl;
            u.clear();
            v.clear();

    }
    return 0;
}
</code></pre>
