#3534
Definiți în C++ clasa Multiset care va implementa multiset-uri de numere naturale în care se definesc operațiile:
Insert(x) – inserează x în multisetErase(x) – elimină elementul de pe pozitia x din multisetFind(x) – returnează valoarea de pe pozitia x din multiset| Problema | Multiset_OOP | Operații I/O |
multiset_oop.in/multiset_oop.out
|
|---|---|---|---|
| Limita timp | 0.35 secunde | Limita memorie |
Total: 30 MB
/
Stivă 5 MB
|
| Id soluție | #64628016 | Utilizator | |
| Fișier | multiset_oop.cpp | Dimensiune | 448 B |
| Data încărcării | 19 Mai 2026, 12:11 | Scor/rezultat | Eroare de compilare |
multiset_oop.cpp:19:6: error: expected ‘;’ after class definition 19 | } | ^ | ; multiset_oop.cpp: In function ‘void Erase(int)’: multiset_oop.cpp:24:27: error: ‘dim’ was not declared in this scope; did you mean ‘fdim’? 24 | for (int i=del; i<dim-1;i++) { | ^~~ | fdim multiset_oop.cpp:25:13: error: ‘v’ was not declared in this scope 25 | v[i]=v[i+1]; | ^ multiset_oop.cpp:27:9: error: ‘dim’ was not declared in this scope; did you mean ‘fdim’? 27 | dim--; | ^~~ | fdim multiset_oop.cpp: In function ‘int Find(int)’: multiset_oop.cpp:32:16: error: ‘v’ was not declared in this scope 32 | return v[cauta]; | ^ multiset_oop.cpp: At global scope: multiset_oop.cpp:34:1: error: expected declaration before ‘}’ token 34 | }; | ^ multiset_oop.cpp: In function ‘int main()’: multiset_oop.cpp:80:16: error: ‘class Multiset’ has no member named ‘Erase’ 80 | ms.Erase(x); | ^~~~~ multiset_oop.cpp:83:16: error: ‘class Multiset’ has no member named ‘Find’ 83 | cout << ms.Find(x); | ^~~~ multiset_oop.cpp:64:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 64 | freopen("multiset_oop.in", "r", stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ multiset_oop.cpp:65:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 65 | freopen("multiset_oop.out", "w", stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Multiset_OOP face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.