The Muggy Weather Robotics Duo

Image
 The Muggy Weather Robotics Duo A C++ System That Thinks, Feels (Sensors!), and Acts Humidity is like the quiet character in the weather story that actually runs the show. On muggy days, everything feels heavier—breathing, drying laundry, running machines, even keeping a data center cool. For people, it’s about comfort and health; for machines, it’s about performance and reliability; for plants and buildings, it’s about moisture balance and mold risk. In robotics and automation, muggy weather isn’t just a nuisance—it’s a signal . It tells your systems when to ventilate, when to dehumidify, when to throttle physically demanding tasks, and when to take preventative maintenance actions. Today, we’ll build a two-program C++ system that “understands” muggy weather: Program A — sensor_hub.cpp A sensor-side program that generates (or ingests) a live stream of environmental data (temperature, relative humidity, pressure, CO₂, VOCs). Think of it as your robotic nose and skin , con...

C++ Mini Projects: Student Grade Calculator

C++ Mini Projects: Student Grade Calculator

Hey everyone, welcome back to the series. Remember we built a simple calculator back in the series, now this is going to be a bit advance version of that calculator. So make sure you haven't missed that blog before starting to understand and work on this one.

Here is what its going to do: Input marks for different subjects, calculate the average, and display the grade. This project enables the user in 
. Inputting marks for all subjects
. calculation of average marks
. assignment of grades based on marks
Here is a short example:
Grade A >=90
Grade B>=80
Grade C>=70 
Grade D>=60
Grade F<60

Skills you will learn throughout: Conditional statements and arithmetic operations.

Here is the go to build the desired project:

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int numSubjects;
    vector<double> marks;
    double total = 0, average = 0;
    char grade;

    // Input the number of subjects
    cout << "Student Grade Calculator\n";
    cout << "------------------------\n";
    cout << "Enter the number of subjects: ";
    cin >> numSubjects;

    // Input marks for each subject
    for (int i = 0; i < numSubjects; ++i) {
        double mark;
        cout << "Enter marks for subject " << i + 1 << ": ";
        cin >> mark;
        marks.push_back(mark); // Add mark to the vector
        total += mark; // Add mark to the total
    }

    // Calculate average
    average = total / numSubjects;

    // Determine grade
    if (average >= 90) {
        grade = 'A';
    } else if (average >= 80) {
        grade = 'B';
    } else if (average >= 70) {
        grade = 'C';
    } else if (average >= 60) {
        grade = 'D';
    } else {
        grade = 'F';
    }

    // Display results
    cout << "\nResults:\n";
    cout << "Total Marks: " << total << endl;
    cout << "Average Marks: " << average << endl;
    cout << "Grade: " << grade << endl;

    return 0;
}

How the code works?

marks.push_back(mark)

Storing marks in vector

Total ...
Keeps the sum of all marks that are entered

Calculation of average...
average = total / numSubjects;

Division of total marks by number of subjects to obtain average 

Assignment of grades....

if (average >= 90) {
    grade = 'A';
} else if (average >= 80) {
    grade = 'B';
} else if (average >= 70) {
    grade = 'C';
} else if (average >= 60) {
    grade = 'D';
} else {
    grade = 'F';
}

Using else if statements for comparing average marks
Assignment of grades based on average marks


Displaying result...

cout << "Total Marks: " << total << endl;
cout << "Average Marks: " << average << endl;
cout << "Grade: " << grade << endl;

Displays average marks and grades accordingly 


Input

Enter the number of subjects: 5
Enter marks for subject 1: 85
Enter marks for subject 2: 78
Enter marks for subject 3: 92
Enter marks for subject 4: 88
Enter marks for subject 5: 76


Output 
Results:
Total Marks: 419
Average Marks: 83.8
Grade: B

So you can see our program is working fine now and deals with all kind of calculations of average and effectively gives the grade. 


Thanks for being with me and I will see you next time.

Comments

Popular posts from this blog

C++ Projects: Basic Traffic Management System

C++ Projects: Book Shop Management System

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