#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 | #49057669 | Utilizator | |
Fișier | qclasa.cpp | Dimensiune | 878 B |
Data încărcării | 13 Februarie 2024, 23:28 | Scor / rezultat | Eroare de compilare |
qclasa.cpp:4:13: error: variable 'std::ifstream cin' has initializer but incomplete type ifstream cin("qclasa.in"); ^ qclasa.cpp:5:14: error: variable 'std::ofstream cout' has initializer but incomplete type ofstream cout("qclasa.out"); ^ qclasa.cpp:7:5: error: 'e' does not name a type { e[50]; ^ qclasa.cpp:9:1: error: expected ';' after struct definition } ^ qclasa.cpp: In function 'int main()': qclasa.cpp:15:5: error: 'fin' was not declared in this scope fin>>n; ^ qclasa.cpp:15:10: error: 'n' was not declared in this scope fin>>n; ^ qclasa.cpp:17:14: error: request for member 'medie' in 'e[i]', which is of non-class type 'int' { fin>>e[i].medie>>e[i].cod>>e[i].abs; ^ qclasa.cpp:17:26: error: request for member 'cod' in 'e[i]', which is of non-class type 'int' { fin>>e[i].medie>>e[i].cod>>e[i].abs; ^ qclasa.cpp:17:36: error: request for member 'abs' in 'e[i]', which is of non-class type 'int' { fin>>e[i].medie>>e[i].cod>>e[i].abs; ^ qclasa.cpp:18:6: error: 'nr' was not declared in this scope nr++; ^ qclasa.cpp:19:21: error: request for member 'medie' in 'e[i]', which is of non-class type 'int' suma=suma+e[i].medie; ^ qclasa.cpp:20:11: error: request for member 'medie' in 'e[i]', which is of non-class type 'int' if(e[i].medie==10)cnt++; ^ qclasa.cpp:22:2: error: 'fout' was not declared in this scope fout<<cnt<<'\n'<<suma/nrelevi<<'\n'; ^ qclasa.cpp:24:13: error: request for member 'abs' in 'e[i]', which is of non-class type 'int' { if(e[i].abs>e[i+1].abs){ int aux=e[i].abs; ^ qclasa.cpp:24:24: error: request for member 'abs' in 'e[(i + 1)]', which is of non-class type 'int' { if(e[i].abs>e[i+1].abs){ int aux=e[i].abs; ^ qclasa.cpp:24:43: error: request for member 'abs' in 'e[i]', which is of non-class type 'int' { if(e[i].abs>e[i+1].abs){ int aux=e[i].abs; ^ qclasa.cpp:25:30: error: request for member 'abs' in 'e[i]', which is of non-class type 'int' e[i].abs=e[i+1].abs; ^ qclasa.cpp:25:41: error: request for member 'abs' in 'e[(i + 1)]', which is of non-class type 'int' e[i].abs=e[i+1].abs; ^ qclasa.cpp:26:31: error: request for member 'abs' in 'e[(i + 1)]', which is of non-class type 'int' e[i+1].abs=aux;} ^ qclasa.cpp:27:12: error: request for member 'abs' in 'e[i]', which is of non-class type 'int' if(e[i].abs==e[i+1].abs) ^ qclasa.cpp:27:24: error: request for member 'abs' in 'e[(i + 1)]', which is of non-class type 'int' if(e[i].abs==e[i+1].abs) ^ qclasa.cpp:28:16: error: request for member 'cod' in 'e[i]', which is of non-class type 'int' if(e[i].cod>e[i+1].cod){ int aux=e[i].cod; ^ qclasa.cpp:28:27: error: request for member 'cod' in 'e[(i + 1)]', which is of non-class type 'int' if(e[i].cod>e[i+1].cod){ int aux=e[i].cod; ^ qclasa.cpp:28:46: error: request for member 'cod' in 'e[i]', which is of non-class type 'int' if(e[i].cod>e[i+1].cod){ int aux=e[i].cod; ^ qclasa.cpp:29:30: error: request for member 'cod' in 'e[i]', which is of non-class type 'int' e[i].cod=e[i+1].cod; ^ qclasa.cpp:29:41: error: request for member 'cod' in 'e[(i + 1)]', which is of non-class type 'int' e[i].cod=e[i+1].cod; ^ qclasa.cpp:30:31: error: request for member 'cod' in 'e[(i + 1)]', which is of non-class type 'int' e[i+1].cod=aux;} ^ qclasa.cpp:34:17: error: request for member 'medie' in 'e[i]', which is of non-class type 'int' fout<<e[i].medie<<' '<<e[i].cod<<' '<<e[i].abs<<"\n"; ^ qclasa.cpp:34:34: error: request for member 'cod' in 'e[i]', which is of non-class type 'int' fout<<e[i].medie<<' '<<e[i].cod<<' '<<e[i].abs<<"\n"; ^ qclasa.cpp:34:49: error: request for member 'abs' in 'e[i]', which is of non-class type 'int' fout<<e[i].medie<<' '<<e[i].cod<<' '<<e[i].abs<<"\n"; ^
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ă.