So this is the problem I'm tackling:
Create 2 Time Objects.
1 Time object should be instantiated using the default constructor.
1 Time object should be instantiated using the constructor that requires hours, minutes and seconds. Read data from keyboard.
Find the difference in hours, minutes and seconds between the two Time objects.
to create the first time object I use
Time timeOne ();
for the second one I thought I needed to declare one which gave me: Time timeTwo (int h, int m, int s);
is that wrong?
I was thinking about asking for user input and setting it...as in:
// main function **********************************************************
int main ()
//create timeone via default constructor
//create timetwo via user input
Time timeOne ();
Time timeTwo (int h, int m, int s);
int hours, minutes, seconds;
cout << "Enter hour" << endl;
cin >> hours;
cout << "Enter minutes" << endl;
cin >> minutes;
cout << "Enter seconds" << endl;
cin >> seconds;
timeTwo.set_Time (int hours, int minutes, int seconds);
//Create function to find difference in hours, minutes, and seconds between
// the two times.
//Declare minuteone, minutetwo, etc,etc
// a. timeone
// b. timetwo
// c. difference between the two times
// End of program statements
cout << "Please press enter once or twice to continue...";
cin.ignore().get(); // hold console window open
return EXIT_SUCCESS; // successful termination
Line 25 does not call the default constructor for the Time class. Instead it is a function prototype for a function called timeOne() which returns a Time object. To instantiate an object using the default constructor leave off the parenthesis. Change line 25 to: Time timeOne;
Similarly, line 26 is a function prototype. It should not have the int before each variable. In addition you need to instantiate it after you have obtained the values from the user, so move line 26 after line 34 and call the constructor using the variables hours, minutes and seconds which have just been initialized from the user: Time timeTwo( hours, minutes, seconds );
Line 36 also should not have the type int in front of the variable names in your call of the member function set_Time(). But that whole line shouldn't be necessary since timeTwo should have been set to the user generated values in the constructor for timeTwo, so eliminate line 36: timeTwo.set_Time (int hours, int minutes, int seconds);