Student Result

Medium Classes & Objects
Solve in Playground →

Problem Statement

Write a C++ program defining a `Result` class that determines pass/fail status based on marks obtained in 5 subjects.

Input Format

Roll number, Name, and 5 integer marks.

Output Format

Print total marks and status ('Pass' if average >= 40, else 'Fail').

Constraints

Marks between 0 and 100

Sample Input

101 Alex 45 50 55 60 65

Sample Output

Roll: 101, Name: Alex, Total: 275, Status: Pass

Explanation

Evaluates complex pass/fail condition logic through object encapsulation.

Starter Code

#include <iostream>
#include <string>

class Result {
public:
    int roll;
    std::string name;
    int marks[5];
    
    void evaluate() {
        // Write your code here
    }
};

int main() {
    Result r;
    if (std::cin >> r.roll >> r.name) {
        for (int i = 0; i < 5; ++i) std::cin >> r.marks[i];
        r.evaluate();
    }
    return 0;
}

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used