I have the code right where I can instert the date/activity and it will print it out, but it is unordered, I can't for the life of me figure out how to organize it. The array I am creating has values for ints chars and strings, and i only need to sort it by looking at the int, but I do not know where to start. Thank you! heres the code separated into 3 files. event.cpp is my main.
#ifndef EVENT_H
#define EVENT_H
class Event
{
public:
Event(int month, int day, int year, string activity);
void print();
private:
int m_month;
int m_day;
int m_year;
string m_activity;
};
#endif
Since you have a class, you can make an operator <, and then just use std::sort().
If you can't, I'd still suggest to make an operator <, but you would have to make a sort algorithm yourself (there are plenty of simple examples out there on wikipedia etc if you need to see some).