Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
762 B
0
Indexable
Never
#include <iostream>
#include <string>
#include <vector>
using namespace std;

class Schooler
{
private:
    string name;
    vector <int> ocenki;
    int classNum;
    float sumOcenok;
public:
    Schooler(string namee) : name(namee) {}
    void AddOcenka(int ocenka)
    {
        ocenki.push_back(ocenka);
    }
    float CountCA()
    {
        for (int i = 0; i < ocenki.size(); i++)
        {
            sumOcenok += ocenki[i];
        }
        sumOcenok /= ocenki.size();
        return sumOcenok;
    }
    void PrintAvarageMark()
    {
        cout << CountCA();
    }
};

int main()
{
    Schooler kristina("Kristina");
    kristina.AddOcenka(4);
    kristina.AddOcenka(5);
    kristina.PrintAvarageMark();
}