invalid types âint[int]â for array subscript
#include <iostream> using namespace std; class Book{ // declaring private class data members private: char book_name[50]; float book_price; int bookid; char author[20]; bool available; int year; public: // declaring constructor Book() { cout<<"Default constructor is called"<<endl; name = "student"; age = 12; } void input (){ int n=4; cout<<"input 4 books"; for (int i=0; i<4 ; i++){ cout<<"Enter details for book "<<i<<":\n"; cout<<"\n book_name"; cin>>book_name[i]; } } // print function to print the class data members value void print() { for(int i=0;i<4;i++){ cout<<"Details for book "<<i<<":\n"; cout<<"\nbook_name:"<<book_name[i]; cout<<"\nbookid:"<<bookid[i]; cout<<"\nbook_price:"<<book_price[i]; cout<<"\nauthor:"<<author[i]; cout<<"\navailable:"<<available[i]; cout<<"\nyear:"<<year[i]; } } }; int main() { // creating object of class using default constructor Book obj; // printing class data members obj.print(); return 0; } along with the other errors i want to solve the int[int] error how may i?