#include "stdafx.h" #include #include #include #include using namespace std; class brak_danych : public exception { const char* what() const throw() { return "brak danych"; } }; class blad_pliku : public exception { const char* what() const throw() { return "blad pliku"; } }; class za_malo_obecnosci : public exception { const char* what() const throw() { return "ponizej polowy obecnosci"; } }; class brak_danych_osobowych : public exception { const char* what() const throw() { return "brak danych osobowych"; } }; class Student { public: string Dane_osobowe; int* punkty; bool* obecnosci; double OcenaKoncowa; int ObliczOcene() { int ile_nieob = 0; for (int i = 0; i < 10; i++) { if (obecnosci[i] == 0)ile_nieob++; } if (ile_nieob >= 5) { throw za_malo_obecnosci(); } else { cout << "Powyzej polowy obecnosci" << endl; OcenaKoncowa = punkty[0]; } } void Wypisz() { if (OcenaKoncowa == 0) { throw brak_danych(); } else { cout << "Ocena: " << OcenaKoncowa<