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

Image
  🌿  Smart Garden Manager in C++ with Robotics, UI, Drones, and Sound "A Rainwater Conservation System for Tomorrow’s Farms" 🧭  1. Introduction: Farming in the Age of Climate Change In a world where clean water is more precious than gold, efficient  rainwater harvesting and plant care systems  are no longer optional — they’re essential. Smart farming doesn’t mean just automating irrigation. It means combining  robotic drones, environmental sensors, and intelligent scheduling  to build a garden that practically takes care of itself. In this guide, we build a  fully functional Garden Manager System  using  C++  that: Captures and conserves rainwater Uses  robotic drones and sensors  to monitor crop health Integrates a  real-time UI  with progress bars and alerts Includes  timers  for scheduling plant growth and drone tasks Plays  interactive sounds  based on crop state and events Whether you'r...

C++ Secure Chat System

 C++ Secure Chat System

A secure chat system in C++ consists of two programs that work together: one for encrypting and sending messages and the other for decrypting and displaying them.

Main Features

The system includes:

Program A (Sender)

  • Encrypts messages using an algorithm like AES or XOR.
  • Saves encrypted messages to a file.

Program B (Receiver)

  • Reads encrypted messages from the file.
  • Decrypts them using the same encryption method.

Program A: Sender

This program encrypts a message and saves it to a file.

Code:

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

// Simple XOR encryption
string encryptMessage(const string& message, char key) {
    string encrypted = message;
    for (char& c : encrypted) {
        c ^= key;
    }
    return encrypted;
}

int main() {
    string message;
    char key = 'X'; // Secret key

    cout << "Enter message to encrypt: ";
    getline(cin, message);

    string encryptedMessage = encryptMessage(message, key);

    // Save to file
    ofstream outFile("secure_message.txt");
    if (outFile) {
        outFile << encryptedMessage;
        outFile.close();
        cout << "Message encrypted and saved.\n";
    } else {
        cout << "Error saving message!\n";
    }

    return 0;
}

Program B: Receiver

This program reads an encrypted message from the file and decrypts it.

Code:

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

// Simple XOR decryption (same as encryption)
string decryptMessage(const string& encryptedMessage, char key) {
    string decrypted = encryptedMessage;
    for (char& c : decrypted) {
        c ^= key;
    }
    return decrypted;
}

int main() {
    string encryptedMessage;
    char key = 'X'; // Same secret key

    // Read from file
    ifstream inFile("secure_message.txt");
    if (inFile) {
        getline(inFile, encryptedMessage);
        inFile.close();

        string decryptedMessage = decryptMessage(encryptedMessage, key);
        cout << "Decrypted message: " << decryptedMessage << endl;
    } else {
        cout << "Error reading message!\n";
    }

    return 0;
}

How It Works Together

  1. Run Program A (Sender):

    • Enter a message.
    • The message is encrypted and saved to a file.
  2. Run Program B (Receiver):

    • Reads the encrypted message from the file.
    • Decrypts it using the same key.
    • Displays the original message.

This simple C++ secure chat system demonstrates basic encryption and decryption using XOR. For stronger security, AES or other cryptographic algorithms should be considered.

Comments

Popular posts from this blog

C++ Projects: Basic Traffic Management System

C++ Projects: Book Shop Management System

C++ Projects: Password Manager