SHOW:
|
|
- or go back to the newest paste.
1 | class Angle { | |
2 | public: | |
3 | Angle(const char* param3) { | |
4 | if ((strcmp(param3,"q")!=0) Angle(QuartzClock *c); | |
5 | if ((strcmp(param3,"a")!=0) Angle(AnalogClock *c); | |
6 | - | clock = c; |
6 | + | aclock = *c; |
7 | - | float angle = clock->GetAngle(); |
7 | + | |
8 | - | string angle1; |
8 | + | |
9 | char ConvertedAngle(const char* tformat) { | |
10 | float angle = clock.GetAngle(); | |
11 | if (strcmp(tformat,"deg")!=0) { | |
12 | angle1=FloatToStr(angle); | |
13 | return angle1; | |
14 | } | |
15 | if ((strcmp(tformat,"rad")!=0) { | |
16 | angle=angle*(M_PI)/180; | |
17 | angle1=FloatToStr(angle); | |
18 | return angle1; | |
19 | } | |
20 | if ((strcmp(tformat,"dms")!=0) { | |
21 | int hrs = int(angle+0.5); | |
22 | int minst = (angle-floor(angle))*60; | |
23 | int mins = int(minst+0.5); | |
24 | int secst = (minst-floor(minst))*60; | |
25 | int secs = int(secst+0.5); | |
26 | string an; | |
27 | sprintf (an, "%s.%s'%s", hrs, mins, secs); | |
28 | return an; | |
29 | } | |
30 | } | |
31 | ||
32 | private: | |
33 | string angle1; | |
34 | }; |