Share
Explore BrainMass

Classes and Enumerators Using C++

Use the type Date (consisting of a month name, day number, and a year number) to develop a class Event to model events scheduled for specified dates. use this class in a program that reads several events and stores these in a vector of Events. After all the events have been entered, the program should display a schedule of events in chronological order. Attached are the program files for structure/class and sorting. I need in c++ hide problem

Attachments

Solution Preview

See below and attached files.
================

// events.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <string>
#include <vector>
#include <iostream>

#include <fstream>
#include <conio.h>
#include <ctime>

using namespace std;

#include <iostream>
#include <ctime>
using namespace std;

class Date
{
private:
short month, day, year;
public:
friend bool operator ==(const Date& d1, const Date& d2);
friend bool operator <(const Date& d1, const Date& d2);
void init(void);
void init( int month, int day, int year);
void print(void);
Date(int m, int d, int y);
Date () ;
};
bool operator <(const Date& d1, const Date& d2)
{
if (d1.year < d2.year) return true ;
else if ((d1.year == d2.year) && (d1.month < d2.month)) return true ;
else if ((d1.year == d2.year) && (d1.month == d2.month) && (d1.day < d2.day)) return true ;
else return false ...

$2.19