1 /* 2 * testuhr.cpp 3 * 4 * Autor: H.Drachenfels 5 * Erstellt am: 9.10.2018 6 */
7
8 #include "testuhr.h"
9 #include <stdexcept>
10
11 testuhr::testuhr()
12 : stunde(0), minute(0)
13 { }
14
15 void testuhr::stellen(int s, int m)
16 {
17 if (s < 0 || m < 0)
18 {
19 throw std::invalid_argument("negative Stunde oder Minute");
20 }
21
22 this->stunde = (s + m / 60) % 24;
23 this->minute = m % 60;
24 }
25
26 void testuhr::ablesen(int& s, int& m) const
27 {
28 s = this->stunde;
29 m = this->minute;
30 }
31