#3164
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 | #59824354 | Utilizator | |
| Fișier | qclasa.cpp | Dimensiune | 1.18 KB |
| Data încărcării | 10 Octombrie 2025, 08:05 | Scor/rezultat | Eroare de compilare |
qclasa.cpp: In function 'int main()': qclasa.cpp:25:16: error: cannot convert 'elev' to 'int' in assignment aux=v[i]; ^ qclasa.cpp:27:20: error: 'aud' was not declared in this scope v[i+1]=aud ; cod=1; ^ qclasa.cpp:31:5: error: expected ';' before 'if' if(v[i].nrabs==v[2].nrabs) ^ qclasa.cpp:32:19: error: unable to find numeric literal operator 'operator"" cod' if(v[i].cod<v[2.cod]) ^ qclasa.cpp:34:57: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'int' [-Wformat=] fscanf(g,"%d%d%d", v[1].cod,v[1].media,v[1].nrabs); ^ qclasa.cpp:34:57: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'int' [-Wformat=] qclasa.cpp:34:57: warning: format '%d' expects argument of type 'int*', but argument 5 has type 'int' [-Wformat=] qclasa.cpp:35:57: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'int' [-Wformat=] fscanf(g,"%d%d%d", v[2].cod,v[2].media,v[2].nrabs); ^ qclasa.cpp:35:57: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'int' [-Wformat=] qclasa.cpp:35:57: warning: format '%d' expects argument of type 'int*', but argument 5 has type 'int' [-Wformat=] qclasa.cpp:39:59: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'int' [-Wformat=] fscanf(g,"%d%d%d", v[2].cod,v[2].media,v[2].nrabs); ^ qclasa.cpp:39:59: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'int' [-Wformat=] qclasa.cpp:39:59: warning: format '%d' expects argument of type 'int*', but argument 5 has type 'int' [-Wformat=] qclasa.cpp:40:60: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'int' [-Wformat=] fscanf(g,"%d%d%d", v[1].cod,v[1].media,v[1].nrabs); ^ qclasa.cpp:40:60: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'int' [-Wformat=] qclasa.cpp:40:60: warning: format '%d' expects argument of type 'int*', but argument 5 has type 'int' [-Wformat=] qclasa.cpp:44:57: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'int' [-Wformat=] fscanf(g,"%d%d%d", v[1].cod,v[1].media,v[1].nrabs); ^ qclasa.cpp:44:57: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'int' [-Wformat=] qclasa.cpp:44:57: warning: format '%d' expects argument of type 'int*', but argument 5 has type 'int' [-Wformat=] qclasa.cpp:45:57: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'int' [-Wformat=] fscanf(g,"%d%d%d", v[2].cod,v[2].media,v[2].nrabs); ^ qclasa.cpp:45:57: warning: format '%d' expects argument of type 'int*', but argument 4 has type 'int' [-Wformat=] qclasa.cpp:45:57: warning: format '%d' expects argument of type 'int*', but argument 5 has type 'int' [-Wformat=] qclasa.cpp:9:22: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] fscanf(f,"%d",&n); ^ qclasa.cpp:11:62: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] fscanf(f,"%d%d%d", &v[i].cod,&v[i].media,&v[i].nrabs); ^ qclasa.cpp:44:58: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] fscanf(g,"%d%d%d", v[1].cod,v[1].media,v[1].nrabs); ^ qclasa.cpp:45:58: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] fscanf(g,"%d%d%d", v[2].cod,v[2].media,v[2].nrabs); ^
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ă.