Click here to Skip to main content
15,881,173 members
Articles / Desktop Programming / MFC

2-3 tree implementation in C++

Rate me:
Please Sign up or sign in to vote.
4.85/5 (13 votes)
1 Oct 2013CPOL6 min read 81.7K   5.5K   34  
2-3 tree implementation in c++
#pragma once

#define MAX_TITLE_SIZE 1024
#include <string.h>
#include <iostream>

class CMovie
{
public:
    CMovie(void);
	CMovie(char *sTitle);
	CMovie(char *sTitle, int iReleaseYear);
    virtual ~CMovie(void);

    inline const char* const getTitle(void) const 
    { 
        return m_sTitle;
    };

	inline int getReleaseYear(void) const 
    { 
        return m_iReleaseYear;
    };

    inline bool operator< (const CMovie& rCMovie) const
    {
        return (strcmp(this->getTitle(), rCMovie.getTitle()) < 0);
    };  

   /** @brief output operator overloading.  
    */
    friend std::ostream& operator<< (std::ostream& out, CMovie& rCMovie)
    {
        out <<rCMovie.getTitle()<<";"<<rCMovie.getReleaseYear(); 
        return out;
    }; 

private:
    char m_sTitle[MAX_TITLE_SIZE + 1];
    int m_iReleaseYear;  
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Netherlands Netherlands
Mohamed Kalmoua is a Microsoft Certified Solutions Developer (MCSD) with over a decade of programming experience. He creates software for the Windows platform using C#, WPF, ASP.NET Core, SQL and C++. Mohamed also loves to build websites using Wordpress and Google analytics.

Comments and Discussions