I have an assignment where I really have no idea how to even begin. It is as follows:

•Create a destructor that prints a message before exiting.
•Create a new function called

void incrementMinutes( Time &, const int );

That increments the minutes by count.
• create a member function that increments the minutes by 1

I'm very new to this stuff, but from what I have learned (apparently) I'm assuming I need a constructor and that the beginning needs to be:

#include <iostream>

using namespace std;

class incrementMinutes
{
public:

incrementMinutes()

Assuming this is where I need to begin at least with a constructor function but I do not even really know what to incorporate into this code, any advice at all would be greatly appreciated

Recommended Answers

All 2 Replies

I think you have mis-understood the assignment. Read it again, it doesn't want you to create a class named incrementMinutes but that is jusst the name of one of the class's methods. The name of the class is probably Time.

I think you should post the exact wording of the assignment so that we are all on the same page. But be careful -- many instructors don't want you to post assignments here. So make sure it's ok before posting.

Your class wouldn't be called incrementMinutes. It would be called Time or something similar. Presumably it would have hours, minutes, and seconds as its data members, and it would have a METHOD called incrementMinutes.

class Time
{
    private:
        int hour;
        int minute;
        int second;

    public:
        Time(int hr, int min, int sec)
        {
            hour = hr;
            minute = min;
            second = sec;
        }

    // more functions here
};
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.