Capstone Softcopy
Capstone Softcopy
Project Title
Course Coordinator
1
SRI RAMAKRISHNA ENGINEERING COLLEGE
[Educational Service: SNR Sons Charitable Trust]
[Autonomous Institution, Reaccredited by NAAC with ‘A+’ Grade]
[Approved by AICTE and Permanently Affiliated to Anna University, Chennai]
[ISO 9001:2015 Certified and all eligible programmes Accredited by NBA]
Vattamalaipalayam, N.G.G.O. Colony Post, Coimbatore – 641 022.
Project title
Assessment
Implementation
Abstract (2)
Report (5)
Demo (3)
Total
(10)
PAGE
S. No. TITLE NUMBER
1. PROJECT DESCRIPTION 4
2. INTRODUCTION 5
3. SOURCE CODE 6
4. SCREENSHOTS 13
5. CONCLUSION 15
3
1. PROJECT DESCRIPTION
4
2. INTRODUCTION
This C++ project implements a real-time Weather Monitoring System, enabling users to
receive accurate and up-to-date weather information for any city worldwide. Utilizing
object-oriented programming principles, the system encapsulates its functionality within a
user-friendly interface powered by ImGui. It leverages the OpenWeatherMap API for data
retrieval and the C++ REST SDK for seamless HTTP communication and JSON handling.
Users can interact with the interface to enter a city name, fetch weather details, and view
key metrics such as temperature (in Kelvin), humidity (percentage), and overall weather
conditions. Robust error handling ensures smooth operation, providing meaningful
feedback in cases of invalid input or connectivity issues. The project adheres to modern
programming standards and demonstrates a sophisticated integration of APIs, GUI design,
and backend functionality, offering an intuitive and practical tool for weather tracking.
5
3. SOURCE CODE
#include "Walnut/Application.h"
#include "Walnut/EntryPoint.h"
#include "Walnut/Image.h"
#include <iostream>
#include <string>
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
using namespace std;
using namespace web;
using namespace web::http;
using namespace web::http::client;
ImGui::Spacing();
if (ImGui::Button("Get Weather", ImVec2(150, 40)))
{
city = string(cityBuffer);
FetchWeatherData(city);
}
7
ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();
ImGui::Spacing();
ImGui::TextWrapped("Stay safe and have a wonderful
day!");
}
else if (temperature == "Error")
{
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "Failed
to fetch weather data. Please try again.");
}
else
8
{
ImGui::TextWrapped("Enter a city name and press 'Get
Weather' to see the forecast.");
}
ImGui::End();
}
private:
void ResetWeatherData()
{
city.clear();
temperature.clear();
humidity.clear();
condition.clear();
}
http_request request(methods::GET);
request.set_request_uri(builder.to_string());
// Update UI variables
temperature = to_string(temp);
humidity = to_string(hum);
condition = weather;
})
.wait();
}
catch (const exception& ex)
{
cerr << "Error: " << ex.what() << endl;
ResetWeatherData(); // Reset weather data on error
temperature = "Error";
}
}
string city;
string temperature;
string humidity;
string condition;
};
11
Walnut::Application* Walnut::CreateApplication(int argc, char**
argv)
{
Walnut::ApplicationSpecification spec;
spec.Name = "Weather Monitoring System";
For more details about the source code, please visit my GitHub repository.
12
4. SCREENSHOTS
1.
2.
13
3.
4.
14
5.CONCLUSION
15