Classes and Objects

  • + 0 comments
    class Student {
    private:
        int scores[5];
        int totalScore = 0;
        
    public:
        void input()
        {
            for (int i = 0; i < 5; i++)
            {
                std::cin >> scores[i];
                totalScore += scores[i];
            }
        }
        
        int calculateTotalScore()
        {
            return totalScore;
        }
    };