-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConversion class.cpp
More file actions
62 lines (58 loc) · 1.12 KB
/
Copy pathConversion class.cpp
File metadata and controls
62 lines (58 loc) · 1.12 KB
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
53
54
55
56
57
58
59
60
61
62
//Convert seconds into HH:MM:SS format
#include <iostream>
using namespace std;
class Conversion {
private:
int s;
int h; //hours with round off values
float h1; //hours with decimal point
int m; //minutes with round off values
float m1; //minutes with decimal point
int secs; // seconds used in the format
public:
void get_info(int a)
{
s = a;
}
void conv_h() //Conversion function hours
{
h = s / 3600;
h1 = s / 3600;
}
void conv_m() //Conversion function minutes
{
float a;
a = h1 - h;
m = a * 60;
m1 = a * 60;
}
void conv_s() //Conversion function seconds
{
float b;
b = m1 - m;
secs = b * 3600;
}
int get_value1()
{
return h;
}
int get_value2()
{
return m;
}
int get_value3()
{
return secs;
}
};
int main()
{
int s;
cout << "enter time in seconds:" << endl;
cin >> s;
Conversion a;
a.get_info(s);
cout << a.get_value1 << ":" << a.get_value2 << ":" << a.get_value3 << endl;
system ("pause");
return 0;
}