Search⌘ K
AI Features

Challenge 2: Calculate Student's Total Marks

Explore how to define a student class in C++ with private variables, constructors, and member functions to retrieve individual marks and calculate their total. This lesson helps you implement encapsulation and class design by building practical coding skills through a challenges-based approach.

Problem Statement

Write a C++ class called student with

  • private member variables:

    • name(string type)

    • mark1 and mark2 (float type)

And member functions:

  • Get_Marks(int marknumber), a ...