title: Just started learning C++
body: <p>Write a program to help me compute the sum. Your program should prompt me to enter numbers until I’m done (when I’m done I’ll enter -1). Then your program should print out the sum.</p>
  
  <pre><code>#include&lt;iostream&gt;
  
    using namespace std;
  
    int main()
    {
          double sum;
          double number;
          double total;
  
  
  
          while (number !=-1)
      {
      cout&lt;&lt;"Input numbers: "&lt;&lt;endl;
      cin&gt;&gt;number;
      total+=number;
      }
      sum = total + number;
      cout&lt;&lt;"The sum is "&lt;&lt;sum&lt;&lt;endl;
      return 0;
  
    }
  </code></pre>
  
  <p>For example I enter 9 and 9 then -1 I get 25. Would I just make double total =2; it works but don't really understand why it outputs 25. What is wrong in my code? I just started learning appreciate the help.</p>