title: Include and run function from other file
body: <p>I have 2 files, main.cpp and xyz.cpp, xyz.cppp have function that making some calculation (and should to output it at the end), and i want call this function from switch in main.cpp</p>
  
  <p>main.cpp : </p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;
  #include &lt;math.h&gt;
  #include &lt;cstdlib&gt; 
  #include "xyz.cpp"
  
  int cl;
  using namespace std;
  int main(int argc, const char * argv[]){
      cout &lt;&lt; ("Make ur choice (1-1)");
      cin &gt;&gt; cl;
  
      switch(cl){
          case (1):{
              // I suppose it should be called here somehow 
          }
      }
  
      return 0;
  }
  </code></pre>
  
  <p>xyz.cpp:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>
      using namespace std;
      int function() {
  
  
          cout &lt;&lt; "Input number: "; 
          cin &gt;&gt; a; 
  
  
          o1p1 = (1+cos(4*a)); 
          o1p2 = (1+cos(2*a)); 
  
  
        o1 = ((sin(4*a))/o1p1)*((cos(2*a))/o1p2);   
  
          cout &lt;&lt; "\nZ1 = ";
          cout &lt;&lt; o1; 
          cout &lt;&lt; "\n "; 
  
      return 0;
  
  }
  </code></pre>