🌿 Smart Garden Manager in C++ with Robotics, UI, Drones, and Sound "A Rainwater Conservation System for Tomorrow’s Farms"

This project consists of two integrated C++ programs designed to improve study habits using technology and AI. These tools work together by sharing a common MySQL database.
The Study Logger is responsible for tracking study timings and the topics covered on a daily basis.
Logs the time spent and subjects studied.
Stores the data in a MySQL database.
Displays daily summaries of study sessions.
The AI Study Advisor analyzes study patterns and offers productivity-based suggestions.
Reads data from the shared database.
Analyzes the distribution of study time.
Provides personalized advice such as:
"You should pay more attention to Maths."
"Try taking shorter breaks."
These programs interact through the same MySQL database:
Logger writes data (subjects and time).
Advisor reads the data and performs analysis.
Before using the programs, set up the required MySQL table using the following SQL script:
CREATE DATABASE study_companion;
USE study_companion;
CREATE TABLE study_logs (
id INT AUTO_INCREMENT PRIMARY KEY,
subject VARCHAR(100),
duration_minutes INT,
log_date DATE
);
// study_logger.cpp
#include <iostream>
#include <mysql/mysql.h>
#include <ctime>
using namespace std;
void logStudy(const string& subject, int duration) {
MYSQL* conn = mysql_init(0);
conn = mysql_real_connect(conn, "localhost", "root", "your_password", "study_companion", 3306, NULL, 0);
if (conn) {
time_t now = time(0);
tm* ltm = localtime(&now);
char date[11];
strftime(date, sizeof(date), "%Y-%m-%d", ltm);
string query = "INSERT INTO study_logs(subject, duration_minutes, log_date) VALUES('" +
subject + "'," + to_string(duration) + ",'" + date + "')";
if (mysql_query(conn, query.c_str()) == 0) {
cout << "Study session logged successfully!" << endl;
} else {
cerr << "Failed to log session: " << mysql_error(conn) << endl;
}
mysql_close(conn);
} else {
cerr << "Connection to database failed!" << endl;
}
}
int main() {
string subject;
int duration;
cout << "Enter subject: ";
getline(cin, subject);
cout << "Enter duration (in minutes): ";
cin >> duration;
logStudy(subject, duration);
return 0;
}
// ai_study_advisor.cpp
#include <iostream>
#include <map>
#include <mysql/mysql.h>
using namespace std;
void analyzeStudyData() {
MYSQL* conn = mysql_init(0);
conn = mysql_real_connect(conn, "localhost", "root", "your_password", "study_companion", 3306, NULL, 0);
if (conn) {
map<string, int> subjectTotals;
if (mysql_query(conn, "SELECT subject, SUM(duration_minutes) FROM study_logs GROUP BY subject") == 0) {
MYSQL_RES* res = mysql_store_result(conn);
MYSQL_ROW row;
cout << "\nStudy Summary:\n";
while ((row = mysql_fetch_row(res))) {
string subject = row[0];
int total = stoi(row[1]);
subjectTotals[subject] = total;
cout << "- " << subject << ": " << total << " minutes\n";
}
mysql_free_result(res);
// Advice
cout << "\nAdvice:\n";
for (auto& pair : subjectTotals) {
if (pair.second < 60)
cout << "You need to spend more time on " << pair.first << ".\n";
else
cout << "Good progress on " << pair.first << "!\n";
}
} else {
cerr << "Query failed: " << mysql_error(conn) << endl;
}
mysql_close(conn);
} else {
cerr << "Connection to database failed!" << endl;
}
}
int main() {
analyzeStudyData();
return 0;
}
A student preparing for competitive exams uses the Study Logger to track hours spent on Chemistry, Biology, and Physics. The AI Advisor identifies that only 30 minutes are being spent daily on Physics and suggests:
"Focus should be increased on Physics to balance your exam preparation."
A high school student logs study sessions for various subjects. After one month, the AI notices History is consistently ignored and recommends revising it more often. This helps the student improve grades in History.
A research student records work on different thesis areas. The AI detects high focus on Methodology and low focus on Conclusion, suggesting:
"Allocate more time to 'Conclusion' before submission."
A teacher logs computer lab sessions daily using the logger. The AI generates weekly insights for each student. Within two months, student performance improves by 20%, especially in previously ignored topics.
During a lockdown, a school instructs students to log study sessions using this system. Teachers use the AI to monitor engagement. One student was found spending twice as much time on Geography than core subjects, prompting timely intervention.
Challenge: Students often focus only on favorite subjects.
Solution:
The AI Advisor detects this trend and advises:
"You are spending 75% of your time on English. Try to focus more on Science and Maths."
Challenge: Students study randomly without tracking progress.
Solution:
The Study Logger ensures consistent tracking with daily summaries. The AI Advisor builds good habits through insights and motivational tips.
Challenge: Generic advice doesn't help every student.
Solution:
The AI provides personalized suggestions, e.g.,
"Good improvement in Science this month. Maintain this pace!"
Comments
Post a Comment