Line 4 should not have a ;
Line 8: author and title only hold a single character.
Line 9: numbor of cars. You can't have spaces in a variable name. Use _.
What does number_of_cars have to do with a library system?
Line 10: You missing a }; to terminate your class.
Lines 4-10: It's conventional to place your class declaration before main.
Line 11: You need to instantiate your class.
Line 13-14: You need to reference your class instance:
Line 16: You're missing a } to terminate main.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
#include <iostream>
using namespace std;
class Book
{
public:
char author[20], title[20];
int price, booknumber, number_of_cars;
};
int main()
{ Book book;
cout << "Enter the new book record in the database" << endl;
cin >> book.author >> book.title;
cout << "The new book record in the database you have inserted is" << book.author << book.title << endl;
}
| |
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
Do NOT number the lines yourself.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.