dimanche 4 novembre 2018

DateType.h directory failed

`

// To declare a class for the Date ADT
// This is the header file DateType.h

class DateType
{
        public:
                void Initialize(int newMonth, int newDay, int newYear);
                int GetYear() const;
                int GetMonth() const;
                int GetDay() const;
        private:
                int year;
                int month;
                int day;
};
`----------



    // Class implementation
    // DateType.cpp

    #include "DateType.h"

    void DateType::Initialize(int newMonth, int newDay, int newYear)
    {
            year = newYear;
            month = newMonth;
            day = newDay;
    }

    int DateType::GetMonth() const
    {
            return month;
    }

    int DateType::GetDay() const
    {
            return day;
    }

    int DateType::GetYear() const
    {
            return year;
    }

    // test driver
// I give the file name: testDriver.cpp
// To compile, type c++ DataType.cpp testDriver.cpp, this will generate an a.out executable.
// Or, type c++ Type.cpp testDriver.cpp –o testdriver, this will generate an executable named testdriver.

#include "DateType.h"
#include <iostream>

using namespace std;

int main()
{
        DateType today;
        DateType anotherDay;
        today.Initialize(9, 24, 2003);
        anotherDay.Initialize(9, 25, 2003);

        cout << "Today is " << today.GetMonth() << "/" << today.GetDay()
                << "/" << today.GetYear() << endl;

        cout << "Anotherday is " << anotherDay.GetMonth() << "/" << anotherDay.GetDay()
                << "/" << anotherDay.GetYear() << endl;

        return 0;
}

My teacher gave us this code to create another function, get current time. How should I get this program to work on here since in her class, we use vi editor. Please show me a way how to do it so I can learn for myself and understand the situation later whenever it comes up again. So when your absolutely complete the question can you just give me a brief summary I can read along as I look at your corrections.

Aucun commentaire:

Enregistrer un commentaire