Answers for "Using functions in Class"

C++
-1

Using functions in Class

class Student{
    int scores[5];
    public:
    void input(){
        for(int i=0; i<5; i++){
            cin >> scores[i];
        }
    }
    int calculateTotalScore(){
        int total = 0;
        for(int i=0; i<5; i++){
            total += scores[i];
        }
        return total;
    }
};
Posted by: Guest on May-16-2021

Code answers related to "Using functions in Class"

Browse Popular Code Answers by Language