help with Time Class

taku nishino (22)
Hey guys,

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.

Now!
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:
1
2
3
4
5
6
7
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);


but it is coming out as an error....

for the comparing the hours and minutes, etc I'm planning on using
timeOne.hours_from(timeTwo);

what am I doing wrong?
supperpiccle (67)
Tell us your error....there could be multiple differnet things that could be wrong....also you will probably need to show all code
taku nishino (22)
Sorry the error reads
"error: expected primary-expression before 'int'"

the entire code is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <iostream>
using namespace std;

#include "ccc_time.h"
#include "ccc_empl.h"
#include "ccc_time.cpp"
#include "ccc_empl.cpp"
#include <iostream>
#include <cmath>
#include <string>
#include <stdlib.h>
#include <ctime>

//Function Prototypes




//  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
//Display:
//	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
}
Registered users can post here. Sign in or register to post.