title: vector elements in ascending order
body: <p>I want to write a boolean function to see if the elements in the vector are in ascending order or not.
  My code so far:</p>
  
  <pre><code>bool if_sorted(vector&lt;int&gt;&amp; v) {
  int i;
  for (; i &lt; v.size(); i++) {
      if(v[i] &lt; v[i + 1]){
          break;
      } else {
          return false; 
  }
  if(v[i] == v.size())
      return true;
  }
  </code></pre>
  
  <p>In the main() function I am just typing in the elements of the vector an with the if_sorted() function I want to see if these values are sorted in ascending order or not.</p>
  
  <p>How can I write this boolean function without functions like is_sorted, or modify my existing code? </p>