Moblie Apps with Qt: Xuan's solution

From CSclasswiki
Jump to: navigation, search
#include <iostream>
#include <string>

using namespace ::std;
class dateClass{
private:
    int day;
    int month;
    int year;
    string comment;
public:
    dateClass();
    ~dateClass();
    void init(int d,int m, int y, string c);
    void print();
};

dateClass::dateClass(){}
dateClass::~dateClass(){}
void dateClass::init(int d, int m, int y, string c){
    day=d;
    month=m;
    year =y;
    comment =c;
}
void dateClass::print(){
    cout << month << "/" << day << "/" << year << ": " << comment;
}
int main()
{
    dateClass dc;
    dc.init(7,14,2014,"Good");
    cout << "\nBastille Day = ";
      dc.print();
      cout << endl;
    return 0;
}