title: C++ identifier is undefined
body: <p>I'm new to C++ I don't understand why I'm getting this error. Out of 5 statements that are similar 3 mark error but the other two are okay. The error is in the main function.   </p>
  
  <pre><code>    #include &lt;iostream&gt;
  using namespace std;
  
  // Function declaration
  void getGallons(int wall);
  void getHours(int gallons);
  void getCostpaint(int gallons, int pricePaint);
  void getLaborcharges(int hours);
  void getTotalcost(int costPaint, int laborCharges);
  
  // Function definition
  void getGallons(int wall)
  {
      int gallons;
  
      gallons = wall / 112;
  
      cout &lt;&lt; "Number of gallons of paint required: " &lt;&lt; gallons &lt;&lt; endl;
  
  
  }
  
  // Function definition
  void getHours(int gallons)
  {
      int hours;
  
      hours = gallons * 8;
  
      cout &lt;&lt; "Hours of labor required: " &lt;&lt; hours &lt;&lt; endl;
  
  
  }
  
  // Function definition
  void getCostpaint(int gallons, int pricePaint)
  {
      int costPaint;
  
      costPaint = gallons * pricePaint;
  
      cout &lt;&lt; "The cost of paint: " &lt;&lt; costPaint &lt;&lt; endl;
  }
  
  // Function definition
  void getLaborcharges(int hours)
  {
      int laborCharges;
  
      laborCharges = hours * 35;
  
      cout &lt;&lt; "The labor charge: " &lt;&lt; laborCharges &lt;&lt; endl;
  }
  
  // Funtion definition
  void getTotalcost(int costPaint, int laborCharges)
  {
      int totalCost;
  
      totalCost = costPaint + laborCharges;
  
      cout &lt;&lt; "The total cost of the job: " &lt;&lt; totalCost &lt;&lt; endl;
  }
  
  // The main method
  int main()
  {
      int wall;
      int pricePaint;
  
      cout &lt;&lt; "Enter square feet of wall: ";
      cin &gt;&gt; wall;
  
      cout &lt;&lt; "Enter price of paint per gallon: ";
      cin &gt;&gt; pricePaint;
  
      getGallons(wall);
  
      getHours(gallons); // error here
  
      getCostpaint(gallons, pricePaint);
  
      getLaborcharges(hours); // error here
  
      getTotalcost(costPaint, laborCharges); //error here
  
      return 0;
  
  }
  </code></pre>
  
  <p>This lesson focused on using functions and passing parameters in the code. I'm not supposed to use global variables. If you have a better way to do this please share. </p>