Project File DSA
Project File DSA
Project File DSA
A PROJECT REPORT
Submitted To
Er. Kanwaldeep Kaur
Submitted by
23BCS12256
23BCS12258
23BCS12240
BACHELOR OF ENGINEERING
IN
Chandigarh University
, 2024
TABLE OF CONTENTS
5.3. Code………………………………………………………………………………………
R
CHAPTER 1. INTRODUCTION
1.1 Introduction to Project: This project presents a Weather Monitoring
System developed in C++. The system is designed to record,
process, and display weather data, such as temperature, humidity,
and atmospheric pressure, collected at regular intervals. It provides a
simple, real-time solution to monitor and log weather conditions,
useful in fields like agriculture, transportation, and environmental
science.
1.2 Identification of Problem: With climate change increasing the
frequency of extreme weather, real-time and accurate weather data is
essential. Existing solutions are often costly or require advanced
technical expertise. This project aims to provide a cost-effective,
efficient, and user-friendly weather monitoring system for
communities and individuals.
Code
#include <iostream>
#include <vector>
#include <string>
#include <ctime>
class WeatherData {
public:
float temperature;
float humidity;
float pressure;
std::string timestamp;
private:
std::string getCurrentTime() const {
time_t now = time(0);
char* dt = ctime(&now);
return std::string(dt);
}
};
class WeatherMonitoringSystem {
private:
std::vector<WeatherData> dataLog;
public:
void recordData(float temperature, float
humidity, float pressure) {
WeatherData newData(temperature, humidity,
pressure);
dataLog.push_back(newData);
}
}
};
int main() {
WeatherMonitoringSystem system;
return 0;
}