please tell me whats wrong in this code, i am getting error, help me to fix this.

Course *array[10][5];
    Course *array2[10][5];
    while(!coursefile.eof()) {
    for (int i=0;i<10;i++)
{
            for (int j=0;j<5;j++)
            {
        coursefile >> array[i][j]->getBook();
        coursefile >> array2[i][j]->getSection();
            }
}
    }

Recommended Answers

All 3 Replies

It would help if you put the whole context here, rather than relying on reading a couple of your other threads.

That said, I think the big problem here is you're trying to input to a function. And a function that returns a value without taking any argument.

Perhaps you need to first define, in words, what it is you're trying to accomplish here. If you mean to read a book name from the file and store it, you have a couple options.
1- override the extraction operator for your class (are you at that level yet?)
2- read the book name into a temporary variable, then pass that variable to a setBook( ) member function.

i got your point somehow, but please you more clear it to me that after taking book name to a temp veriable, how can i pass it to setboob() member function

after taking book name to a temp veriable, how can i pass it to setboob() member function

setboob(temp_variable);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.