Implemented Weather class fields, constructor and output
This commit is contained in:
15
Weather.cpp
Normal file
15
Weather.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "Weather.h"
|
||||
|
||||
Weather::Weather(const std::string& city, double lon, double lat, double temperature,
|
||||
const std::string& weather, double windSpeed, int clouds)
|
||||
: city(city), lon(lon), lat(lat), temperature(temperature),
|
||||
weather(weather), windSpeed(windSpeed), clouds(clouds) {
|
||||
}
|
||||
|
||||
void Weather::printWeather() const {
|
||||
std::cout << "City: " << city << " (Lat: " << lat << ", Lon: " << lon << ")\n"
|
||||
<< "Temperature: " << temperature << " deg. C\n"
|
||||
<< "Weather: " << weather << "\n"
|
||||
<< "Wind Speed: " << windSpeed << " m/s\n"
|
||||
<< "Cloudness: " << clouds << " %\n";
|
||||
}
|
||||
19
Weather.h
Normal file
19
Weather.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
class Weather {
|
||||
private:
|
||||
std::string city; // Киров
|
||||
double lon; // 49.6601
|
||||
double lat; // 58.5966
|
||||
double temperature; // 5.69
|
||||
std::string weather; // дождь
|
||||
double windSpeed; // 4.27
|
||||
int clouds; // 100
|
||||
|
||||
public:
|
||||
Weather(const std::string& city, double lon, double lat, double temperature,
|
||||
const std::string& weather, double windSpeed, int clouds);
|
||||
|
||||
void printWeather() const;
|
||||
};
|
||||
Reference in New Issue
Block a user