title: Given sequence of integers a(1),a(2), a(n). Create a new sequence through replacing all a(i) by 1, if |a(i)=max (a(1),a(2),a(n)); or by 0 otherwise
body: <p>I already have some code, but my lecturer told that it is comparing only the first integer in the array, and negative numbers are not taking into consideration</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  int main() {
      int max, n, check;    //declaring variables
      check = 1;
      while (check == 1) {     //programm executes repitedly
          cout &lt;&lt; &quot;Enter array element count: &quot;;
          cin &gt;&gt; n;             //user inputs number of elements in array
          if (n &lt;= 0)            //check that number should be bigger then 0
              cout &lt;&lt; &quot;Please enter number greater then 0&quot;;
          int array[n];           //declaring an array
          for (int i = 0; i &lt; n; i++) {      //entering numbers to array
              cout &lt;&lt; &quot;Enter number: &quot;;
              cin &gt;&gt; array[i];
              if (max &lt; array[i]) {            //assigning the biggest number of array as max
                  max = array[i];
              }
          }
          for (int i = 0; i &lt; n; i++) {      //assigning value to max==1
              if (array[i] == max) {
                  array[i] = 1;
              }
              else {                            // to other value assigning 0
                  array[i] = 0;
              }
              cout &lt;&lt; array[i];                   //showing the results
          }
          cout &lt;&lt; &quot;\n1 - continue, 0 - end\n&quot;;
          cin &gt;&gt; check;
      }
  }
  </code></pre>