Classes and Objects

  • + 0 comments
    class Student
    {
    
    private: 
        vector<int> scores; 
    
    public: 
        void input()
        {
            int a, b, c, d, e; 
            cin >> a >> b >> c >> d >> e; 
            scores = { a, b, c, d ,e }; 
        };
        int calculateTotalScore()
        {
            return accumulate(scores.begin(), scores.end(), 0);
        }; 
    
    };