expected a ; even though it's a function


I'm building a library system for my project, then as I was writing my code, I got an error about "Expected a ';' C/C++(65) [Ln 53, Col 13]

I double checked all the codes before it, and there was no error, only the show_tabular one got an error, even the function after it had no error.

I also declared it along with the other functions

1
2
3
4
  void student::show_tabular() const
{
    cout << book_number << setw(6) << book_title << setw(6) << author << setw(6) << date_publish << endl;
}
This is the class code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class book {
    int book_number;
    int student_number;
    int date_publish;
    int date_borrow;
    int date_return;
    char name[50];
    string book_title, author;

public:
    void get_data();
    void show_data() const;
    void show_tabular() const;
    int return_book_number() const;
};
If you get more than one error you should start fixing the first one. Then recompile and repeat.

Because sometimes one error can cause many errors later in the code that are not real errors. Fixing the first error might make the later errors go away.

Does both the student class and the book class have a function named show_tabular()?
Last edited on
Oh, wait, I figured it out, Thanks Peter87

The problem was I assigned show_tabular with student instead of book, that's why it was returning an error.
Topic archived. No new replies allowed.