title: C++ Function Parameters: Passing Data to Subroutines and variables
body: <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  void show_menu ()
  {
      cout &lt;&lt; "Welcome" &lt;&lt; endl;
      cout &lt;&lt; "1) Match line-up" &lt;&lt; endl;
      cout &lt;&lt; "2) Match result" &lt;&lt; endl;
      cout &lt;&lt; "3) Quit program" &lt;&lt; endl;
  
  }
  
  int selection ()
  {
      cout &lt;&lt; "Select option" &lt;&lt; endl;
  
      int input;
      cin &gt;&gt; input;
  
      return input;
  }
  
  int process (int x)
  {
      switch(x)
      {
      case 1:
          cout &lt;&lt; "Line ups" &lt;&lt; endl;
      case 2:
          cout &lt;&lt; "Arsenal 3 - Crystal Palace 0" &lt;&lt; endl;
      case 3:
          cout &lt;&lt; "Quitting" &lt;&lt; endl;
      default:
          cout &lt;&lt; "Select Option1" &lt;&lt; endl;
      }
  
  }
  
  int main ()
  {
      show_menu();
      int input2 = selection ();
      process(input2);
  
      return 0;
  }
  </code></pre>
  
  <p>So this is a code for some menu and input option, i wrote it as a exercise on subroutins, but in the function below i had a problem that i solved throgh some trile and arror, but still i dont get it.</p>
  
  <pre><code>int process (int x)
  {
      switch(x)
      {
      case 1:
          cout &lt;&lt; "Line ups" &lt;&lt; endl;
      case 2:
          cout &lt;&lt; "Arsenal 3 - Crystal Palace 0" &lt;&lt; endl;
      case 3:
          cout &lt;&lt; "Quitting" &lt;&lt; endl;
      default:
          cout &lt;&lt; "Select Option1" &lt;&lt; endl;
      }
  
  }
  </code></pre>
  
  <p>Why do i need the variable (int x) in order dor this function to work?
  i have a feel that i dont understand something very basic. pls help)</p>