#2736
Baza De Date
Se citește numărul n
și apoi n
articole cu structura prenume nume salariu vârstă funcție număr_de_telefon email
. Fiecare articol este plasat pe câte o linie, câmpurile sale fiind separate prin câte un spațiu. Câmpurile salariu
și vârstă
conțin numere naturale, celelalte conțin șiruri de caractere.
Se citește apoi un număr natural p
cuprins între 1
și 7
și un caracter c
care poate fi +
sau -
.
Se cere ordonarea celor n
articole în funcție de p
și c
, astfel:
p=1
, ordonarea se face după prenume
; dacă p=2
, ordonarea se face după nume
; dacă p=3
, ordonarea se face după salariu
; dacă p=4
, ordonarea se face după vârstă
; dacă p=5
, ordonarea se face după funcție
; dacă p=6
, ordonarea se face după număr_de_telefon
; dacă p=7
, ordonarea se face după email
;c
are valoarea +
, ordonarea va fi crescătoare, iar dacă c
are valoarea -
, ordonarea va fi descrescătoare;Problema | Baza De Date | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.01 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #45595413 | Utilizator | |
Fișier | baza_de_date.cpp | Dimensiune | 3.41 KB |
Data încărcării | 16 Octombrie 2023, 23:04 | Scor / rezultat | 100 puncte |
baza_de_date.cpp: In function 'int comp_prenume(poz, poz)': baza_de_date.cpp:16:111: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_prenume(poz a, poz b) { return strcmp(a.prenume, b.prenume) < 0 || strcmp(a.prenume, b.prenume) == 0 && a.pozz < b.pozz; } ^ baza_de_date.cpp: In function 'int comp_nume(poz, poz)': baza_de_date.cpp:17:96: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_nume(poz a, poz b) { return strcmp(a.nume, b.nume) < 0 || strcmp(a.nume, b.nume) == 0 && a.pozz < b.pozz; } ^ baza_de_date.cpp: In function 'int comp_tel(poz, poz)': baza_de_date.cpp:18:91: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_tel(poz a, poz b) { return strcmp(a.tel, b.tel) < 0 || strcmp(a.tel, b.tel) == 0 && a.pozz < b.pozz; } ^ baza_de_date.cpp: In function 'int comp_email(poz, poz)': baza_de_date.cpp:19:101: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_email(poz a, poz b) { return strcmp(a.email, b.email) < 0 || strcmp(a.email, b.email) == 0 && a.pozz < b.pozz; } ^ baza_de_date.cpp: In function 'int comp_fct(poz, poz)': baza_de_date.cpp:20:91: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_fct(poz a, poz b) { return strcmp(a.fct, b.fct) < 0 || strcmp(a.fct, b.fct) == 0 && a.pozz < b.pozz; } ^ baza_de_date.cpp: In function 'int comp_salariu(poz, poz)': baza_de_date.cpp:21:89: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_salariu(poz a, poz b) { return a.salariu < b.salariu || a.salariu == b.salariu && a.pozz < b.pozz; } ^ baza_de_date.cpp: In function 'int comp_varsta(poz, poz)': baza_de_date.cpp:22:84: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_varsta(poz a, poz b) { return a.varsta < b.varsta || a.varsta == b.varsta && a.pozz < b.pozz; } ^ baza_de_date.cpp: In function 'int comp_prenume1(poz, poz)': baza_de_date.cpp:24:112: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_prenume1(poz a, poz b) { return strcmp(a.prenume, b.prenume) > 0 || strcmp(a.prenume, b.prenume) == 0 && a.pozz > b.pozz; } ^ baza_de_date.cpp: In function 'int comp_nume1(poz, poz)': baza_de_date.cpp:25:97: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_nume1(poz a, poz b) { return strcmp(a.nume, b.nume) > 0 || strcmp(a.nume, b.nume) == 0 && a.pozz > b.pozz; } ^ baza_de_date.cpp: In function 'int comp_tel1(poz, poz)': baza_de_date.cpp:26:92: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_tel1(poz a, poz b) { return strcmp(a.tel, b.tel) > 0 || strcmp(a.tel, b.tel) == 0 && a.pozz > b.pozz; } ^ baza_de_date.cpp: In function 'int comp_email1(poz, poz)': baza_de_date.cpp:27:102: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_email1(poz a, poz b) { return strcmp(a.email, b.email) > 0 || strcmp(a.email, b.email) == 0 && a.pozz > b.pozz; } ^ baza_de_date.cpp: In function 'int comp_fct1(poz, poz)': baza_de_date.cpp:28:92: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_fct1(poz a, poz b) { return strcmp(a.fct, b.fct) > 0 || strcmp(a.fct, b.fct) == 0 && a.pozz > b.pozz; } ^ baza_de_date.cpp: In function 'int comp_salariu1(poz, poz)': baza_de_date.cpp:29:90: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_salariu1(poz a, poz b) { return a.salariu > b.salariu || a.salariu == b.salariu && a.pozz > b.pozz; } ^ baza_de_date.cpp: In function 'int comp_varsta1(poz, poz)': baza_de_date.cpp:30:85: warning: suggest parentheses around '&&' within '||' [-Wparentheses] int comp_varsta1(poz a, poz b) { return a.varsta > b.varsta || a.varsta == b.varsta && a.pozz > b.pozz; } ^
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
1 | 0 secunde | OK. | 10 | 10 | Exemplu | |
2 | 0 secunde | OK. | 10 | 10 | ||
3 | 0 secunde | OK. | 20 | 20 | ||
4 | 0 secunde | OK. | 20 | 20 | ||
5 | 0 secunde | OK. | 20 | 20 | ||
6 | 0 secunde | OK. | 10 | 10 | ||
7 | 0 secunde | OK. | 10 | 10 | ||
Punctaj total | 100 |
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Baza De Date 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ă.