🌿 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++.....an object-oriented approach

 c++ can be used for making large-scale programs and applications. It is used for developing operating systems,game -programming,software engineering and much more.

c++ programs

c++ code for a simple banking system

#include <iostream>

#include <vector>

#include <string>


class Account {

private:

    int accountNumber;

    std::string accountHolder;

    double balance;


public:

    Account(int number, const std::string& holder, double initialBalance)

        : accountNumber(number), accountHolder(holder), balance(initialBalance) {}


    int getAccountNumber() const {

        return accountNumber;

    }


    std::string getAccountHolder() const {

        return accountHolder;

    }


    double getBalance() const {

        return balance;

    }


    void deposit(double amount) {

        if (amount > 0) {

            balance += amount;

            std::cout << "Deposited $" << amount << " into account " << accountNumber << ".\n";

        } else {

            std::cout << "Invalid deposit amount.\n";

        }

    }


    void withdraw(double amount) {

        if (amount > 0 && amount <= balance) {

            balance -= amount;

            std::cout << "Withdrawn $" << amount << " from account " << accountNumber << ".\n";

        } else {

            std::cout << "Invalid withdrawal amount or insufficient funds.\n";

        }

    }

};


class Bank {

private:

    std::vector<Account> accounts;

    int nextAccountNumber;


public:

    Bank() : nextAccountNumber(1) {}


    void createAccount(const std::string& holder, double initialBalance) {

        Account newAccount(nextAccountNumber++, holder, initialBalance);

        accounts.push_back(newAccount);

        std::cout << "Account created successfully. Account number: " << newAccount.getAccountNumber() << "\n";

    }


    void deposit(int accountNumber, double amount) {

        for (auto& account : accounts) {

            if (account.getAccountNumber() == accountNumber) {

                account.deposit(amount);

                return;

            }

        }

        std::cout << "Account not found.\n";

    }


    void withdraw(int accountNumber, double amount) {

        for (auto& account : accounts) {

            if (account.getAccountNumber() == accountNumber) {

                account.withdraw(amount);

                return;

            }

        }

        std::cout << "Account not found.\n";

    }


    void displayBalance(int accountNumber) {

        for (const auto& account : accounts) {

            if (account.getAccountNumber() == accountNumber) {

                std::cout << "Account " << accountNumber << " balance: $" << account.getBalance() << "\n";

                return;

            }

        }

        std::cout << "Account not found.\n";

    }

};


int main() {

    Bank bank;


    // Create accounts

    bank.createAccount("John Doe", 1000.0);

    bank.createAccount("Jane Smith", 500.0);


    // Perform transactions

    bank.deposit(1, 200.0);

    bank.withdraw(2, 100.0);

    bank.displayBalance(1);

    bank.displayBalance(2);


    return 0;

Comments

Popular posts from this blog

C++ Projects: Basic Traffic Management System

C++ Projects: Book Shop Management System

C++ Projects: Password Manager