-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeather.cpp
More file actions
42 lines (36 loc) · 713 Bytes
/
Weather.cpp
File metadata and controls
42 lines (36 loc) · 713 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
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include <cstring>
#include <iomanip>
using namespace std;
#include "Weather.h"
namespace sict {
const char* Weather::getDate() const {
return date;
}
double Weather::getLowTemp() const {
return lowTemp;
}
void Weather::set(const char* date_description, double low, double high) {
strcpy(date, date_description);
highTemp = high;
lowTemp = low;
}
void Weather::display() const {
cout << date;
cout.fill('_');
if (highTemp == 15) {
cout.width(13);
}
else {
cout.width(12);
}
cout.precision(1);
cout.setf(ios::fixed);
cout << highTemp;
cout.fill('_');
cout.width(6);
cout.precision(1);
cout.setf(ios::fixed);
cout << lowTemp << endl;
}
}