0

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();
            }
}
    }
3
Contributors
3
Replies
27
Views
3 Years
Discussion Span
Last Post by Moschops
0

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.

0

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

0

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

setboob(temp_variable);

Edited by Moschops

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.