title: qualified-id in declaration before '(' token
body: <p>This is some crazy error and is giving me a lot of trouble.   </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  class Book {
  private:
      int bookid;
      char bookname[50];
      char authorname[50];
      float cost;
  
  public:
      void getinfo(void) {
          for (int i = 0; i &lt; 5; i++) {
              cout &lt;&lt; "Enter Book ID" &lt;&lt;endl;
              cin &gt;&gt; bookid;
  
              cout &lt;&lt; "Enter Book Name" &lt;&lt; endl;
              cin &gt;&gt; bookname;
              cout &lt;&lt; "Enter Author Name" &lt;&lt; endl;
              cin &gt;&gt; authorname;
              cout &lt;&lt; "Enter Cost" &lt;&lt; endl;
              cin &gt;&gt; cost;
          }
      }
  
      void displayinfo(void);
  
  };
  
  
  int main()
  {
      Book bk[5];
      for (int i = 0; i &lt; 5; i++) {
          bk[i].getinfo();
      }
  
      void Book::displayinfo() {
          for(int i = 0; i &lt; 5; i++) {
              cout &lt;&lt; bk[i].bookid;
              cout &lt;&lt; bk[i].bookname;
              cout &lt;&lt; bk[i].authorname;
              cout &lt;&lt; bk[i].cost;
          }
      }
  
      return 0;
  }
  </code></pre>
  
  <p>The error, as noted in the title is expected declaration before '}' token at the line void Book::displayinfo() in main</p>
  
  <p>Also this error is coming expected '}' at end of input</p>