#3164
qclasa
Se dau n
, reprezentând numărul de elevi apoi, pe câte un rând, datele fiecărui elev: codul (număr natural de maxim 4
cifre), media la informatică (număr natural de la 1
la 10
) și numărul de absențe. Definiți un tip structură pentru a putea memora datele unui elev și rezolvați cerințele:
a) memorați datele tuturor elevilor într-un vector de structuri de tipul definit;
b) afișați numărul de elevi cu media 10
c) afișați media clasei (se va afișa doar partea întreagă a ei).
d) afișați primii doi elevi după absențe (elevii cu cele mai multe absențe). Dacă sunt mai mulți elevi cu același număr de absențe se afișează în ordine crescătoare a codului. Dacă sunt mai mult de doi elevi număr maxim de absențe se afișează doar doi.
Problema | qclasa | Operații I/O |
![]() qclasa.in /qclasa.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #50879180 | Utilizator | |
Fișier | qclasa.cpp | Dimensiune | 1.39 KB |
Data încărcării | 12 Mai 2024, 01:35 | Scor / rezultat | Eroare de compilare |
qclasa.cpp: In function 'int main()': qclasa.cpp:19:5: error: reference to 'cin' is ambiguous cin >> n; ^ qclasa.cpp:4:10: note: candidates are: std::ifstream cin ifstream cin("qclasa.in"); ^ In file included from qclasa.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ qclasa.cpp:22:9: error: reference to 'cin' is ambiguous cin >> a[i].cod >> a[i].medie >> a[i].abs; ^ qclasa.cpp:4:10: note: candidates are: std::ifstream cin ifstream cin("qclasa.in"); ^ In file included from qclasa.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ qclasa.cpp:26:5: error: reference to 'cout' is ambiguous cout << cnt << '\n' << cc / n << '\n'; ^ qclasa.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("qclasa.out"); ^ In file included from qclasa.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ qclasa.cpp:27:32: error: 'sort' was not declared in this scope sort(a + 1, a + n + 1, comp); ^ qclasa.cpp:29:9: error: reference to 'cout' is ambiguous cout << a[i].cod << ' ' << a[i].medie << ' ' << a[i].abs << "\n"; ^ qclasa.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("qclasa.out"); ^ In file included from qclasa.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ qclasa.cpp: At global scope: qclasa.cpp:33:13: error: redefinition of 'std::ifstream cin' ifstream cin("qclasa.in"); ^ qclasa.cpp:4:10: error: 'std::ifstream cin' previously declared here ifstream cin("qclasa.in"); ^ qclasa.cpp:34:14: error: redefinition of 'std::ofstream cout' ofstream cout("qclasa.out"); ^ qclasa.cpp:5:10: error: 'std::ofstream cout' previously declared here ofstream cout("qclasa.out"); ^ qclasa.cpp:35:5: error: redefinition of 'int n' int n , cnt , cc; ^ qclasa.cpp:6:5: error: 'int n' previously declared here int n , cnt , cc; ^ qclasa.cpp:35:9: error: redefinition of 'int cnt' int n , cnt , cc; ^ qclasa.cpp:6:9: error: 'int cnt' previously declared here int n , cnt , cc; ^ qclasa.cpp:35:15: error: redefinition of 'int cc' int n , cnt , cc; ^ qclasa.cpp:6:15: error: 'int cc' previously declared here int n , cnt , cc; ^ qclasa.cpp:36:8: error: redefinition of 'struct elev' struct elev ^ qclasa.cpp:7:8: error: previous definition of 'struct elev' struct elev ^ qclasa.cpp:39:7: error: invalid type in declaration before ';' token }a[50]; ^ qclasa.cpp:39:7: error: conflicting declaration 'int a [50]' qclasa.cpp:10:2: error: 'a' has a previous declaration as 'elev a [50]' }a[50]; ^ qclasa.cpp: In function 'bool comp(elev, elev)': qclasa.cpp:40:6: error: redefinition of 'bool comp(elev, elev)' bool comp(elev a, elev b) ^ qclasa.cpp:11:6: error: 'bool comp(elev, elev)' previously defined here bool comp(elev a, elev b) ^ qclasa.cpp: In function 'int main()': qclasa.cpp:46:5: error: redefinition of 'int main()' int main() ^ qclasa.cpp:17:5: error: 'int main()' previously defined here int main() ^ qclasa.cpp:48:5: error: reference to 'cin' is ambiguous cin >> n; ^ qclasa.cpp:4:10: note: candidates are: std::ifstream cin ifstream cin("qclasa.in"); ^ In file included from qclasa.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ qclasa.cpp:51:9: error: reference to 'cin' is ambiguous cin >> a[i].cod >> a[i].medie >> a[i].abs; ^ qclasa.cpp:4:10: note: candidates are: std::ifstream cin ifstream cin("qclasa.in"); ^ In file included from qclasa.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ qclasa.cpp:55:5: error: reference to 'cout' is ambiguous cout << cnt << '\n' << cc / n << '\n'; ^ qclasa.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("qclasa.out"); ^ In file included from qclasa.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ qclasa.cpp:56:32: error: 'sort' was not declared in this scope sort(a + 1, a + n + 1, comp); ^ qclasa.cpp:58:9: error: reference to 'cout' is ambiguous cout << a[i].cod << ' ' << a[i].medie << ' ' << a[i].abs << "\n"; ^ qclasa.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("qclasa.out"); ^ In file included from qclasa.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema qclasa face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.