title: ‘sortBook’ was not declared in this scope
body: <blockquote>
  <p>I cannot solve the error - main.cpp:31:34: error: ‘sortBook’ was not declared in this scope in the line  sortBook(arr,arr+n,comparator);</p>
  </blockquote>
  <blockquote>
  <p>I apologize for asking a question that should have a simple solution, but it's driving me nuts. I've checked for all the common errors.</p>
  </blockquote>
  <pre><code> #include&lt;iostream&gt;
      using namespace std;
       class BOOK{
          private:
              char bookname[20];
              float bookprice;
          public:
              void getBookDetails()
              {
              cout&lt;&lt;&quot;Enter the Book Name:&quot;;
               cin&gt;&gt;bookname;
               cout&lt;&lt;&quot;Enter the Book Price:&quot;;
               cin&gt;&gt;bookprice;
                }
                void displayDetails()
                {
                  cout&lt;&lt;&quot;Book Name:&quot;&lt;&lt;bookname&lt;&lt;endl;
                  cout&lt;&lt;&quot;Book Price:&quot;&lt;&lt;bookprice&lt;&lt;endl;
                }
       };
       bool comparator(string a,string b)
      {
          return a&lt;b;
      }
      int main()
      {
          int n=5;
          string arr[]={&quot;sandwich&quot;,&quot;apple&quot;,&quot;banana&quot;,&quot;zombie&quot;,&quot;pear&quot;};
          
          sortBook(arr,arr+n,comparator);
             for(int i=0;i&lt;n;i++)
          {
              cout&lt;&lt;arr[i]&lt;&lt;&quot; &quot;;
          }
      }
  </code></pre>