#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 | #64498025 | Utilizator | |
| Fișier | baza_de_date.cpp | Dimensiune | 2.48 KB |
| Data încărcării | 11 Mai 2026, 12:21 | Scor/rezultat | Eroare de compilare |
baza_de_date.cpp: In function ‘int main()’: baza_de_date.cpp:32:45: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 32 | if (c == '+' && strcmp(v[j].first_name, v[j + 1].first_name) > 0) ok = true; | ~~~~~^~~~~~~~~~ | | | unsigned char* In file included from /usr/include/c++/13/cstring:42, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:121, from baza_de_date.cpp:1: /usr/include/string.h:156:32: note: initializing argument 1 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:32:66: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 32 | if (c == '+' && strcmp(v[j].first_name, v[j + 1].first_name) > 0) ok = true; | ~~~~~~~~~^~~~~~~~~~ | | | unsigned char* /usr/include/string.h:156:50: note: initializing argument 2 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:33:45: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 33 | if (c == '-' && strcmp(v[j].first_name, v[j + 1].first_name) < 0) ok = true; | ~~~~~^~~~~~~~~~ | | | unsigned char* /usr/include/string.h:156:32: note: initializing argument 1 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:33:66: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 33 | if (c == '-' && strcmp(v[j].first_name, v[j + 1].first_name) < 0) ok = true; | ~~~~~~~~~^~~~~~~~~~ | | | unsigned char* /usr/include/string.h:156:50: note: initializing argument 2 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:37:45: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 37 | if (c == '+' && strcmp(v[j].last_name, v[j + 1].last_name) > 0) ok = true; | ~~~~~^~~~~~~~~ | | | unsigned char* /usr/include/string.h:156:32: note: initializing argument 1 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:37:65: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 37 | if (c == '+' && strcmp(v[j].last_name, v[j + 1].last_name) > 0) ok = true; | ~~~~~~~~~^~~~~~~~~ | | | unsigned char* /usr/include/string.h:156:50: note: initializing argument 2 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:38:45: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 38 | if (c == '-' && strcmp(v[j].last_name, v[j + 1].last_name) < 0) ok = true; | ~~~~~^~~~~~~~~ | | | unsigned char* /usr/include/string.h:156:32: note: initializing argument 1 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:38:65: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 38 | if (c == '-' && strcmp(v[j].last_name, v[j + 1].last_name) < 0) ok = true; | ~~~~~~~~~^~~~~~~~~ | | | unsigned char* /usr/include/string.h:156:50: note: initializing argument 2 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:52:45: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 52 | if (c == '+' && strcmp(v[j].role, v[j + 1].role) > 0) ok = true; | ~~~~~^~~~ | | | unsigned char* /usr/include/string.h:156:32: note: initializing argument 1 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:52:60: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 52 | if (c == '+' && strcmp(v[j].role, v[j + 1].role) > 0) ok = true; | ~~~~~~~~~^~~~ | | | unsigned char* /usr/include/string.h:156:50: note: initializing argument 2 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:53:45: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 53 | if (c == '-' && strcmp(v[j].role, v[j + 1].role) < 0) ok = true; | ~~~~~^~~~ | | | unsigned char* /usr/include/string.h:156:32: note: initializing argument 1 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:53:60: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 53 | if (c == '-' && strcmp(v[j].role, v[j + 1].role) < 0) ok = true; | ~~~~~~~~~^~~~ | | | unsigned char* /usr/include/string.h:156:50: note: initializing argument 2 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:57:46: warning: comparison between two arrays [-Warray-compare] 57 | if (c == '+' && v[j].address > v[j + 1].address) ok = true; | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ baza_de_date.cpp:57:46: note: use unary ‘+’ which decays operands to pointers or ‘&(v[j].info::address)[0] > &(v[(j + 1)].info::address)[0]’ to compare the addresses baza_de_date.cpp:58:46: warning: comparison between two arrays [-Warray-compare] 58 | if (c == '-' && v[j].address < v[j + 1].address) ok = true; | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ baza_de_date.cpp:58:46: note: use unary ‘+’ which decays operands to pointers or ‘&(v[j].info::address)[0] < &(v[(j + 1)].info::address)[0]’ to compare the addresses baza_de_date.cpp:62:45: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 62 | if (c == '+' && strcmp(v[j].email_address, v[j + 1].email_address) > 0) ok = true; | ~~~~~^~~~~~~~~~~~~ | | | unsigned char* /usr/include/string.h:156:32: note: initializing argument 1 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:62:69: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 62 | if (c == '+' && strcmp(v[j].email_address, v[j + 1].email_address) > 0) ok = true; | ~~~~~~~~~^~~~~~~~~~~~~ | | | unsigned char* /usr/include/string.h:156:50: note: initializing argument 2 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:63:45: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 63 | if (c == '-' && strcmp(v[j].email_address, v[j + 1].email_address) < 0) ok = true; | ~~~~~^~~~~~~~~~~~~ | | | unsigned char* /usr/include/string.h:156:32: note: initializing argument 1 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ baza_de_date.cpp:63:69: error: invalid conversion from ‘unsigned char*’ to ‘const char*’ [-fpermissive] 63 | if (c == '-' && strcmp(v[j].email_address, v[j + 1].email_address) < 0) ok = true; | ~~~~~~~~~^~~~~~~~~~~~~ | | | unsigned char* /usr/include/string.h:156:50: note: initializing argument 2 of ‘int strcmp(const char*, const char*)’ 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~
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ă.