title: how to reference 3 functions while using struct
body: <p>//I want to use 3 functions here with 1 struct that one function do the input
   and one for calculation and the other one for out put but 
  I don't know how to reference //the variables in functions rec2 and rec3. I want to do it without using pointer</p>
  
  <pre><code>struct rectangle {
      float length;
      float width;
      float area,perimeter;
  }; 
  
  rectangle rec1();
  rectangle rec2();
  rectangle rec3();
  
  int main(){
      rectangle f;
      f = rec1(); 
      f=rec2();
      f = rec3(); 
  
      return 0;
  }
  
  rectangle rec1(){
      rectangle h;
      cout&lt;&lt;"insert the length: ";
      cin&gt;&gt;h.length;
      cout&lt;&lt;"\ninsert width: ";
      cin&gt;&gt;h.width;    
      return h;    
  }
  
  rectangle rec2(){
      rectangle z;
      z.area=z.length*z.width;
      z.perimeter=2*(z.length+z.width);
      return z;           
  }
  
  rectangle rec3(){
      rectangle x;
      cout&lt;&lt;"\narea is: "&lt;&lt;x.area&lt;&lt;endl&lt;&lt;"perimeter is: "&lt;&lt;x.perimeter&lt;&lt;endl;
      return x;
  }
  </code></pre>