Skip to content

siddhant1729/weather-fetcher-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒฆ๏ธ Weather Fetcher C++ ๐ŸŒฆ๏ธ

C++17 cURL nlohmann/json MIT License

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

  1. Clone the Repository: bash Copy Edit git clone https://github.com/yourusername/Weather-Fetcher.git
  2. 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
  3. Compile: bash Copy Edit g++ weather.cpp -o weather.exe -lcurl -I/usr/include -L/usr/lib
  4. 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! ๐Ÿ˜Ž

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages