title: C++ Program calculate carpet cost of rooms
body: <p>Currently I am in a C++ class and were are learning about functions. Our assignment was to create a program to calculate the total cost including price per sq foot, labor, and tax of each room given by the user's input for the count. Here is my program, which I can't get to compile and I do not know why. Thanks for anyone who helps me I greatly appreciate it.</p>
  
  <p>For example, the input:
  2
  2 2 2
  2 2 2</p>
  
  <p>Should give the output:
  2 2 22.4</p>
  
  <p>but it is printing this instead:</p>
  
  <p>2 2 9.87</p>
  
  <p>I have no clue what is wrong.. I looked at all my formulas and they look correct.  A room with dimensions of 2*2, cost per sq foot of 2, should give a total cost of 11.2, I'm am so confused.  Maybe I set the functions up incorrectly?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  using namespace std;
  
  void getdata (int&amp;, int&amp;, float&amp;);
  float InstalledPrice (int , int, float );
  float totalprice (float);
  void printdata (int , int, float);
  
  
  int length, width, count, x;
  float installation, costpersqfoot, price;
  
  int main()
  {
  
  
  
      cout &lt;&lt; "Enter the amount of rooms.\n";
      cin &gt;&gt; x;
  
      for(count = x; count != 0; count --)
      {
          getdata (length, width, costpersqfoot);
          InstalledPrice (length, width, costpersqfoot);
          totalprice (installation);
          if (count ==1)
          {
              printdata (length, width, price);
          }   
  
      }
  
  }
  
  void getdata(int &amp; length, int &amp; width, float &amp; costpersqft)
  {
      cin &gt;&gt; length &gt;&gt; width &gt;&gt; costpersqft;
  }
  
  float InstalledPrice (int a, int b, float c)
  {
      installation = 0;
      const float LABOR_COST = 0.35;
      float sqfoot;
      sqfoot = length * width;
      installation = (costpersqfoot * sqfoot) + (LABOR_COST * sqfoot) + installation;
  }
  
  float totalprice(float installation)
  {
      const float TAX_RATE = 0.05;
      price = (installation * TAX_RATE) + installation;
  }
  
  void printdata(int length, int width, float price)
  {
      cout &lt;&lt; length &lt;&lt; " " &lt;&lt; width &lt;&lt; " " &lt;&lt; price &lt;&lt; endl;
  }
  </code></pre>