#2736
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 | #25186654 | Utilizator | |
| Fișier | baza_de_date.cpp | Dimensiune | 3.35 KB |
| Data încărcării | 30 Octombrie 2020, 08:04 | Scor/rezultat | Eroare de compilare |
baza_de_date.cpp: In function 'int comp_prenume(poz, poz)': baza_de_date.cpp:10:68: error: 'strcmp' was not declared in this scope 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:11:59: error: 'strcmp' was not declared in this scope 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:12:56: error: 'strcmp' was not declared in this scope 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:13:62: error: 'strcmp' was not declared in this scope 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:14:56: error: 'strcmp' was not declared in this scope 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:15:88: 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:16:83: 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:17:69: error: 'strcmp' was not declared in this scope 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:18:60: error: 'strcmp' was not declared in this scope 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:19:57: error: 'strcmp' was not declared in this scope 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:20:63: error: 'strcmp' was not declared in this scope 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:21:57: error: 'strcmp' was not declared in this scope 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:22:89: 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:23:84: 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;} ^ baza_de_date.cpp: In function 'int main()': baza_de_date.cpp:35:57: error: 'sort' was not declared in this scope if(p == 1) sort(a + 1 , a + n + 1 , comp_prenume); ^ baza_de_date.cpp:36:59: error: 'sort' was not declared in this scope else if(p == 2) sort(a + 1 , a + n + 1 , comp_nume); ^ baza_de_date.cpp:37:62: error: 'sort' was not declared in this scope else if(p == 3) sort(a + 1 , a + n + 1 , comp_salariu); ^ baza_de_date.cpp:38:61: error: 'sort' was not declared in this scope else if(p == 4) sort(a + 1 , a + n + 1 , comp_varsta); ^ baza_de_date.cpp:39:58: error: 'sort' was not declared in this scope else if(p == 5) sort(a + 1 , a + n + 1 , comp_fct); ^ baza_de_date.cpp:40:58: error: 'sort' was not declared in this scope else if(p == 6) sort(a + 1 , a + n + 1 , comp_tel); ^ baza_de_date.cpp:41:60: error: 'sort' was not declared in this scope else if(p == 7) sort(a + 1 , a + n + 1 , comp_email); ^ baza_de_date.cpp:47:58: error: 'sort' was not declared in this scope if(p == 1) sort(a + 1 , a + n + 1 , comp_prenume1); ^ baza_de_date.cpp:48:60: error: 'sort' was not declared in this scope else if(p == 2) sort(a + 1 , a + n + 1 , comp_nume1); ^ baza_de_date.cpp:49:63: error: 'sort' was not declared in this scope else if(p == 3) sort(a + 1 , a + n + 1 , comp_salariu1); ^ baza_de_date.cpp:50:62: error: 'sort' was not declared in this scope else if(p == 4) sort(a + 1 , a + n + 1 , comp_varsta1); ^ baza_de_date.cpp:51:59: error: 'sort' was not declared in this scope else if(p == 5) sort(a + 1 , a + n + 1 , comp_fct1); ^ baza_de_date.cpp:52:59: error: 'sort' was not declared in this scope else if(p == 6) sort(a + 1 , a + n + 1 , comp_tel1); ^ baza_de_date.cpp:53:61: error: 'sort' was not declared in this scope else if(p == 7) sort(a + 1 , a + n + 1 , comp_email1); ^ baza_de_date.cpp: In function 'int comp_prenume(poz, poz)': baza_de_date.cpp:10:131: warning: control reaches end of non-void function [-Wreturn-type] 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:11:116: warning: control reaches end of non-void function [-Wreturn-type] 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:12:111: warning: control reaches end of non-void function [-Wreturn-type] 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:13:121: warning: control reaches end of non-void function [-Wreturn-type] 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:14:111: warning: control reaches end of non-void function [-Wreturn-type] 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_prenume1(poz, poz)': baza_de_date.cpp:17:132: warning: control reaches end of non-void function [-Wreturn-type] 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:18:117: warning: control reaches end of non-void function [-Wreturn-type] 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:19:112: warning: control reaches end of non-void function [-Wreturn-type] 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:20:122: warning: control reaches end of non-void function [-Wreturn-type] 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:21:112: warning: control reaches end of non-void function [-Wreturn-type] int comp_fct1(poz a , poz b){return strcmp(a.fct , b.fct) > 0 || strcmp(a.fct , b.fct) == 0 && a.pozz > b.pozz;} ^
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ă.