Simple program with 2 functions doesn`t work
<p>I'm new to C++ and trying to make two simple functions, but something goes wrong.</p>

<p>I am trying to do the following:</p>

<pre><code>1.Function for input some data.
2.Function to show what data is input.
</code></pre>

<p>I just want to make it simple. The code I wrote so far is:</p>

<pre><code>#include &lt;iostream&gt;
void masiv()
{
  int x[10];
  int n, i;
  int min;
  int max=0, imax=0, imin;

  cout &lt;&lt; "Enter the number of elements: ";
  cin &gt;&gt; n;

  for(i=0; i &lt; n; i++)
  {
      cout &lt;&lt; "Input value for x["&lt;&lt;i&lt;&lt;"]=";
      cin &gt;&gt; x[i];

  if (min &gt; x[i])
  {
      min = x [i];
      imin = i;
  }

  if (max &lt; x[i])
  {
     max = x[i];
     imax = i;
  }
}
void rezult()
{
  cout &lt;&lt; "the smallest value on is xthe biggest value on is x["&lt;&lt;imin&lt;&lt;"]=" &lt;&lt; min &lt;&lt;endl;
  cout &lt;&lt; "nai golqmata stoinost e na x["&lt;&lt;imax&lt;&lt;"]=" &lt;&lt; max &lt;&lt;endl;
}
void main()
{
  masiv();
  rezult();
}
</code></pre>

<p>I got bunch of errors. I know this is poor code but as I mentioned I'm just starting. 
Thanks</p>

<p>P.s. Sorry for my English</p>

<p>Edit: Working with this code.</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

void masiv(int&amp; min, int&amp;max)
{
 int x[10];
 int n;
 int i;
 int imin, imax;
 cout &lt;&lt; "Enter the number of elements: ";
 cin &gt;&gt; n;
 for(i=0; i &lt; n; i++)
 {
  cout &lt;&lt; "Input value for x["&lt;&lt;i&lt;&lt;"]=";
  cin &gt;&gt; x[i];
  if(min &gt; x[i])
  {
    min = x [i];
    imin = i;
  }
  if(max &lt; x[i])
  {
    max = x[i];
    imax = i;
  }
 }
}

 void rezult(int min, int max)
{
 cout &lt;&lt; "the smallest value on is x= " &lt;&lt; min &lt;&lt; endl;
 cout &lt;&lt; "the biggest value on is x= " &lt;&lt; max &lt;&lt; endl;
 system ("pause");
}

int main(int argc, char** argv)
{
 int min = 999999; 
 int max = -999999;
 masiv(min,max);
 rezult(min,max);
 return 0;
}
</code></pre>
