error C2679 binary '<<' no operator found

I have a function that searches an array for matching titles and outputs that title, but I am getting the error C2679: binary '<<': no operator found which takes a right hand operand of type 'Entry'(or there is no acceptable conversion)

This is the function where the error is

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  void Entrylist::Find() //look up a song in the entrylist
	
{
	char findTitle[36];
	cout << "What is the title or artist of the entry to be looked up?";
		
		cin.getline(findEntry, 36);

		int thisEntry = FindTitle(findEntry);

		if(thisEntry == -1)
			cout << findEntry << " not found in current list" << endl;
		else
		{
			cout << "Entry found: ";
			cout << entryList[thisEntry]; //ERROR HERE
		}
}


Class Entry looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class Entry
{
public:
    Entry();		
    
    void Set(const char* t, const char* a, Style st, int sz);
  
    const char* GetTitle() const;		
    const char* GetAuthor() const;	
    int GetSize() const;			
    Style GetCategory() const;		// returns the category
    
    void Display() const;			
    
private:
    char title[36];	
    char author[21];	
    Category category;	// style of the given entry
    int size;		
};



What is causing this?
Last edited on
There is no overloaded output operator which takes and Entry type.
What do you think it should output?
It is supposed to output the Entry that matches the title or author it is searching for
I changed it to entryList[thisEntry++].Display(), i think that should work. thank you
output the Entry
How? What should be outputted to screen? How would compiler know that?
You can also overload the << operator to handle user defined types.

http://www.learncpp.com/cpp-tutorial/93-overloading-the-io-operators/
Is there an alternative to overloading the io operator if I am not allowed to add an operator overload function?
You can create a public member function in the class that can be called to print out whatever data members you want to print. It sounds like that's what you might have been doing with Display()?
and what about the input?
Topic archived. No new replies allowed.