Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- const int CMAX = 15;
- class Student{
- private:
- string nume;
- string prenume;
- int nota1;
- int nota2;
- int nota3;
- int nota4;
- int nota5;
- double calcMedie(){
- return double(nota1+nota2+nota3+nota4+nota5)/5;
- }
- int esteIntegralist(){
- if(nota1>5&¬a2>5&¬a3>5&¬a4>5&¬a5>5)
- return 1;
- return 0;
- }
- public:
- Student(string nume,string prenume,int nota1, int nota2, int nota3, int nota4, int nota5){
- this->nume = nume;
- this->prenume = prenume;
- this->nota1 = nota1;
- this->nota2 = nota2;
- this->nota3 = nota3;
- this->nota4 = nota4;
- this->nota5 = nota5;
- }
- Student(): nume(), prenume(), nota1(0), nota2(0), nota3(0), nota4(0), nota5(0){
- }
- int areBursaMerit(){
- if(esteIntegralist()==1&&calcMedie()>=8&&calcMedie()<=9.80)
- return 1;
- return 0;
- }
- int areBursaPerformanta(){
- if(esteIntegralist()==1&&calcMedie()>=9.80)
- return 1;
- return 0;
- }
- };
- //struct catalog{
- // string nume[2];
- // int note[6];
- //}studenti[65540];
- int main(){
- string nume[2];
- int note[6];
- int n;
- int merit = 0, performanta = 0;
- float medie, suma;
- cin >> n;
- for(int i=1;i<=n;i++)
- {
- suma = 0;
- cin >> nume[0] >> nume[1] >> note[0] >> note[1] >> note[2] >> note[3] >> note[4];
- //Student(nume[0],nume[1],note[0],note[1],note[2],note[3],note[4]);
- if(Student(nume[0],nume[1],note[0],note[1],note[2],note[3],note[4]).areBursaPerformanta()==1){
- //cout << nume[0] << " " << nume[1] << " are bursa de merit" << '\n';
- merit++;
- }
- else if(Student(nume[0],nume[1],note[0],note[1],note[2],note[3],note[4]).areBursaMerit()==1){
- performanta++;
- //cout << nume[0] << " " << nume[1] << " are bursa de performanta" << '\n';
- }
- }
- cout << merit << " " << performanta;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement