title: Why is my C++ program generating nonsense math?
body: <p>My program is below</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      int a;
      int b; 
      int c;
      double perimeter = (a + b + c);
      int s=0.5*(a + b + c);
  
      cout &lt;&lt; "Enter three numbers for the lengths of a triangle with sides a, b, and c. The first number should be the smallest, and the last should be the longest.";
      cin &gt;&gt; a;
      cin &gt;&gt; b;
      cin &gt;&gt; c;
  
      cout &lt;&lt; "Lengths " ;
      cout &lt;&lt; a; 
      cout &lt;&lt; " " ;
      cout &lt;&lt; b; 
      cout &lt;&lt; " ";
      cout &lt;&lt; c;
  
      cout &lt;&lt; "The perimeter of the triangle is ";
      cout &lt;&lt; perimeter ;
  
      cout &lt;&lt; "s equals " ;
      cout &lt;&lt; s;
  }
  </code></pre>
  
  <p>This is the output: </p>
  
  <pre><code>Enter three numbers for the lengths of a triangle with sides a, b, and c.  The first number should be the smallest, and the last should be the longest.
  1
  2
  3
  Lengths 1 2 3
  The perimeter of the triangle is 32061
  s equals 16030 
  </code></pre>
  
  <p>Last I checked, 1 + 2 + 3 does not equal 32061.  What is happening, and how can I fix this?</p>
  
  <p>//I am guessing it's because I do not have the proper heading //(#somethingoranother)?<br>
  //Or I haven't declared it? but I don't know how.
  //I recall using sqrt to find roots in the past as a function without</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  
      int main()
      {
      int a = 0;
      int b = 0; 
      int c = 0;
      double area = 0;
      double sqrt=0;
  
  
        cout &lt;&lt; "Enter three numbers for the lengths of a triangle with sides a, b, and c.  The first number should be the smallest, and the last should ne the longest.";
        cin &gt;&gt; a;
        cin &gt;&gt; b;
        cin &gt;&gt; c;
  
      int perimeter = (a + b + c);
      int s=0.5*(a + b + c);
  
      area = sqrt ( s*(s - a)*(s - b)*(s - c) );
  
  
       cout &lt;&lt; "The perimeter of the triangle is ";
        cout &lt;&lt; perimeter ;
        cout &lt;&lt; "." ;
  
        cout &lt;&lt; " s equals " ;
        cout &lt;&lt; s; 
        cout &lt;&lt; ".  ";
  
        cout &lt;&lt; "Area is ";
        cout &lt;&lt; area;
  
      }
  </code></pre>
  
  <p>just entering a long formula for "area =" but the computer doesn't seem to like  that either</p>