-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalcBell.cpp
More file actions
31 lines (25 loc) · 820 Bytes
/
Copy pathCalcBell.cpp
File metadata and controls
31 lines (25 loc) · 820 Bytes
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
#include "Header.h"
//This function Calculates the time when the bells will ring
//and out puts them to the user. If the time is more than 60
//min it will reset back to 0.
void RingBell::CalcTime()
{
int count = 1;
for (vector<int>::iterator iter = ring_times.begin(); iter != ring_times.end(); iter++) //Iterate through the vector
{
int Temp_hour = 0;
int Temp_min = 0;
Temp_hour = current_hour;
Temp_min = current_min + *iter;
while (Temp_min > 60) //If more then 60 min move back to 0
{
Temp_min = Temp_min - 60;
Temp_hour++;
}
if (Temp_hour > 12) //If it is more then 12 hours move back to 0
Temp_hour = Temp_hour - 12;
cout << count << "\t" << Temp_hour << ":" << setfill('0') << setw(2) << Temp_min << endl; //output
count++;
}
cout << endl;
}