Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct Student {
- int br_indeks;
- int oceni[40];
- int br_oceni;
- double prosek() {
- double p = 0.0;
- for(int i = 0; i < br_oceni; i++) {
- p += oceni[i];
- }
- p /= (double) br_oceni;
- return p;
- }
- bool dobil_nagrada() {
- if(prosek() >= 9.0) {
- return true;
- }
- else {
- return false;
- }
- }
- void pecati() {
- cout << br_indeks << " " << br_oceni << endl;
- cout << prosek() << endl;
- }
- };
- struct LaboratoriskaGrupa {
- Student students[20];
- int br_studenti;
- int br_vezbi[20];
- int kolku_vezbi(int ind) {
- for(int i = 0; i < br_studenti; i++) {
- if(students[i].br_indeks == ind) {
- return br_vezbi[i];
- }
- }
- return -1;
- }
- int kolku_potpisi() {
- int brojac = 0;
- for(int i = 0; i < br_studenti; i++) {
- if(br_vezbi[i] >= 8) {
- brojac++;
- }
- }
- return brojac;
- }
- void popolni(Student *s, int br_s, int *br_v) {
- br_studenti = br_s;
- for(int i = 0; i < br_s; i++) {
- students[i] = s[i];
- br_vezbi[i] = br_v[i];
- }
- }
- };
- int main() {
- int n;
- cin >> n;
- Student niza[n];
- for(int i = 0; i < n; i++) {
- cin >> niza[i].br_indeks >> niza[i].br_oceni;
- for(int j = 0; j < niza[i].br_oceni; j++) {
- cin >> niza[i].oceni[j];
- }
- }
- int vezbi[n];
- for(int i = 0; i < n; i++) {
- cin >> vezbi[i];
- }
- LaboratoriskaGrupa grupa;
- grupa.popolni(niza, n, vezbi);
- int brojac = 0;
- for(int i = 0; i < grupa.br_studenti; i++) {
- if(grupa.students[i].prosek() >= 9.0) {
- grupa.students[i].pecati();
- brojac++;
- }
- }
- cout << brojac << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement