A real-time weather fetching program built using **C++**, **cURL**, and **nlohmann/json**. It fetches live weather data from OpenWeatherMap API and displays detailed weather information!
๐ Features โ Fetches real-time weather data using REST API โ Displays detailed weather information:๐ก๏ธ Temperature, Feels Like ๐ง๏ธ Humidity, Cloudiness ๐ฌ๏ธ Wind Speed, Pressure ๐ Sunrise and Sunset Times โ Uses cURL for HTTP requests โ Parses JSON using nlohmann/json โ Clean output with proper formatting ๐ฅ๏ธ Demo bash Copy Edit
./weather.exe
**************** Real-Time Weather Fetcher *****************
Using REST API, cURL, nlohmann/json
Enter city name: Patna
City: Patna, IN
Temperature: 29.43 ยฐC
Feels Like: 28.8 ยฐC
Condition: Clear sky
Humidity: 40%
Wind Speed: 3.2 m/s
Cloudiness: 0%
Visibility: 10 km
Pressure: 1012 hPa
Sunrise: 05:30:21
Sunset: 18:10:45
๐ ๏ธ Installation
- Clone the Repository: bash Copy Edit git clone https://github.com/yourusername/Weather-Fetcher.git
- Install Dependencies:
Install cURL:
bash
Copy
Edit
pacman -S mingw-w64-x86_64-curl
Install nlohmann/json: bash Copy Edit pacman -S mingw-w64-x86_64-nlohmann-json - Compile: bash Copy Edit g++ weather.cpp -o weather.exe -lcurl -I/usr/include -L/usr/lib
- Run:
bash
Copy
Edit
./weather.exe
๐ API Key Setup Sign up at OpenWeatherMap Get your API key Update the api_key value in the code: cpp Copy Edit string api_key = "YOUR_API_KEY";
๐๏ธ How It Works User inputs the city name Program sends an HTTP GET request to OpenWeatherMap using cURL Response is parsed using nlohmann/json Weather data is extracted and displayed in readable format ๐ Libraries Used โ cURL โ For HTTP Requests โ nlohmann/json โ For JSON Parsing
๐ Future Improvements ๐ Add support for multiple languages ๐ฅ๏ธ Create a GUI using Qt ๐ฃ๏ธ Add voice input using Speech Recognition
๐ License This project is licensed under the MIT License.
โค๏ธ Made with C++ by Siddhant โ How to Modify: Replace YOUR_API_KEY with your actual OpenWeatherMap key Update yourusername with your GitHub username Update future improvements if you add new features Let me know if you need to tweak anything! ๐