#3534
Multiset_OOP
C++
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 multisetProblema | 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 | #58036775 | Utilizator | |
Fișier | multiset_oop.cpp | Dimensiune | 369 B |
Data încărcării | 09 Mai 2025, 21:12 | Scor / rezultat | Eroare de compilare |
multiset_oop.cpp: In constructor 'Multiset::Multiset(int)': multiset_oop.cpp:10:33: error: no matching function for call to 'std::multiset<int>::multiset(const int&)' ms = new multiset<int>(n); ^ multiset_oop.cpp:10:33: note: candidates are: In file included from /usr/include/c++/4.8/set:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:86, from multiset_oop.cpp:1: /usr/include/c++/4.8/bits/stl_multiset.h:214:7: note: std::multiset<_Key, _Compare, _Alloc>::multiset(std::initializer_list<_Tp>, const _Compare&, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::allocator_type = std::allocator<int>] multiset(initializer_list<value_type> __l, ^ /usr/include/c++/4.8/bits/stl_multiset.h:214:7: note: no known conversion for argument 1 from 'const int' to 'std::initializer_list<int>' /usr/include/c++/4.8/bits/stl_multiset.h:200:7: note: std::multiset<_Key, _Compare, _Alloc>::multiset(std::multiset<_Key, _Compare, _Alloc>&&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>] multiset(multiset&& __x) ^ /usr/include/c++/4.8/bits/stl_multiset.h:200:7: note: no known conversion for argument 1 from 'const int' to 'std::multiset<int>&&' /usr/include/c++/4.8/bits/stl_multiset.h:189:7: note: std::multiset<_Key, _Compare, _Alloc>::multiset(const std::multiset<_Key, _Compare, _Alloc>&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>] multiset(const multiset& __x) ^ /usr/include/c++/4.8/bits/stl_multiset.h:189:7: note: no known conversion for argument 1 from 'const int' to 'const std::multiset<int>&' /usr/include/c++/4.8/bits/stl_multiset.h:176:9: note: template<class _InputIterator> std::multiset<_Key, _Compare, _Alloc>::multiset(_InputIterator, _InputIterator, const _Compare&, const allocator_type&) multiset(_InputIterator __first, _InputIterator __last, ^ /usr/include/c++/4.8/bits/stl_multiset.h:176:9: note: template argument deduction/substitution failed: multiset_oop.cpp:10:33: note: candidate expects 4 arguments, 1 provided ms = new multiset<int>(n); ^ In file included from /usr/include/c++/4.8/set:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:86, from multiset_oop.cpp:1: /usr/include/c++/4.8/bits/stl_multiset.h:160:9: note: template<class _InputIterator> std::multiset<_Key, _Compare, _Alloc>::multiset(_InputIterator, _InputIterator) multiset(_InputIterator __first, _InputIterator __last) ^ /usr/include/c++/4.8/bits/stl_multiset.h:160:9: note: template argument deduction/substitution failed: multiset_oop.cpp:10:33: note: candidate expects 2 arguments, 1 provided ms = new multiset<int>(n); ^ In file included from /usr/include/c++/4.8/set:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:86, from multiset_oop.cpp:1: /usr/include/c++/4.8/bits/stl_multiset.h:146:7: note: std::multiset<_Key, _Compare, _Alloc>::multiset(const _Compare&, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::multiset<_Key, _Compare, _Alloc>::allocator_type = std::allocator<int>] multiset(const _Compare& __comp, ^ /usr/include/c++/4.8/bits/stl_multiset.h:146:7: note: no known conversion for argument 1 from 'const int' to 'const std::less<int>&' /usr/include/c++/4.8/bits/stl_multiset.h:137:7: note: std::multiset<_Key, _Compare, _Alloc>::multiset() [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>] multiset() ^ /usr/include/c++/4.8/bits/stl_multiset.h:137:7: note: candidate expects 0 arguments, 1 provided multiset_oop.cpp: In member function 'void Multiset::Erase(int)': multiset_oop.cpp:20:21: error: missing template arguments before '.' token ms.erase(set.begin() + x); ^ multiset_oop.cpp: In member function 'int Multiset::Find(int)': multiset_oop.cpp:26:5: error: expected ';' before '}' token } ^ multiset_oop.cpp: In function 'int main()': multiset_oop.cpp:56:43: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen("multiset_oop.in", "r", stdin); ^ multiset_oop.cpp:57:45: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] 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ă.