Compare commits
2 Commits
f1700302e4
...
0aa3be643e
| Author | SHA1 | Date | |
|---|---|---|---|
| 0aa3be643e | |||
| 5621f19feb |
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;
|
||||||
|
};
|
||||||
47
endpoints/weather.json
Normal file
47
endpoints/weather.json
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"coord":{
|
||||||
|
"lon":49.6601,
|
||||||
|
"lat":58.5966
|
||||||
|
},
|
||||||
|
"weather":[
|
||||||
|
{
|
||||||
|
"id":501,
|
||||||
|
"main":"Rain",
|
||||||
|
"description":"дождь",
|
||||||
|
"icon":"10d"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"base":"stations",
|
||||||
|
"main":{
|
||||||
|
"temp":5.69,
|
||||||
|
"feels_like":2.56,
|
||||||
|
"temp_min":5.69,
|
||||||
|
"temp_max":5.69,
|
||||||
|
"pressure":998,
|
||||||
|
"humidity":100,
|
||||||
|
"sea_level":998,
|
||||||
|
"grnd_level":977
|
||||||
|
},
|
||||||
|
"visibility":133,
|
||||||
|
"wind":{
|
||||||
|
"speed":4.27,
|
||||||
|
"deg":171,
|
||||||
|
"gust":11.57
|
||||||
|
},
|
||||||
|
"rain":{
|
||||||
|
"1h":1.15
|
||||||
|
},
|
||||||
|
"clouds":{
|
||||||
|
"all":100
|
||||||
|
},
|
||||||
|
"dt":1679907593,
|
||||||
|
"sys":{
|
||||||
|
"country":"RU",
|
||||||
|
"sunrise":1679883870,
|
||||||
|
"sunset":1679929745
|
||||||
|
},
|
||||||
|
"timezone":10800,
|
||||||
|
"id":548408,
|
||||||
|
"name":"Киров",
|
||||||
|
"cod":200
|
||||||
|
}
|
||||||
22
endpoints/weather.xml
Normal file
22
endpoints/weather.xml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<current>
|
||||||
|
<city id="548408" name="Êèðîâ">
|
||||||
|
<coord lon="49.6601" lat="58.5966"/>
|
||||||
|
<country>RU</country>
|
||||||
|
<timezone>10800</timezone>
|
||||||
|
<sun rise="2023-03-27T02:24:30" set="2023-03-27T15:09:05"/>
|
||||||
|
</city>
|
||||||
|
<temperature value="5.69" min="5.69" max="5.69" unit="celsius"/>
|
||||||
|
<feels_like value="2.56" unit="celsius"/>
|
||||||
|
<humidity value="100" unit="%"/>
|
||||||
|
<pressure value="998" unit="hPa"/>
|
||||||
|
<wind>
|
||||||
|
<speed value="4.27" unit="m/s" name="Gentle Breeze"/>
|
||||||
|
<gusts value="11.57"/>
|
||||||
|
<direction value="171" code="S" name="South"/>
|
||||||
|
</wind>
|
||||||
|
<clouds value="100" name="ïàñìóðíî"/>
|
||||||
|
<visibility value="133"/>
|
||||||
|
<precipitation value="0.45" mode="rain" unit="1h"/>
|
||||||
|
<weather number="500" value="íåáîëüøîé äîæäü" icon="10d"/>
|
||||||
|
<lastupdate value="2023-03-27T08:55:52"/>
|
||||||
|
</current>
|
||||||
Reference in New Issue
Block a user