title: C++ printf only appear in the end
body: <p>This is the program that I was trying to make to learn</p>
  
  <p>the program works but the message "type the rectangle height" and "type the rectangle width" only appear when the program is over</p>
  
  <pre><code>#include &lt; stdio.h &gt;
  
  using namespace std;
  
  float calculateArea(float a, float b)
  {
      return a * b;
  }
  
  float calculatePerimeter(float a, float b)
  {
      return 2*a + 2*b;
  }
  
  void showMessage(char *msg, float vlr)
  {
      printf("%s %5.2f", msg, vlr);
  }
  
  int main()
  {
      float height, width, area, perimeter;
  
      printf("type the rectangle height");
  
      scanf("%f%*c", &amp;height);
  
      printf("type the rectangle width");
  
      scanf("%f%*c", &amp;width);
  
      area = calculateArea(height, width);
  
      perimeter = calculatePerimeter(height, width);
  
      showMessage("The area value is =", area);
  
      showMessage("The perimeter value is =", perimeter);
  
      return 0;
  }
  </code></pre>