#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 | #50928725 | Utilizator | |
Fișier | multiset_oop.cpp | Dimensiune | 1.23 KB |
Data încărcării | 14 Mai 2024, 18:34 | Scor / rezultat | Eroare de compilare |
multiset_oop.cpp: In function 'int main()': multiset_oop.cpp:53:5: error: reference to 'cin' is ambiguous cin >> n; ^ multiset_oop.cpp:8:10: note: candidates are: std::ifstream cin ifstream cin("multiset_oop.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from multiset_oop.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ multiset_oop.cpp:57:9: error: reference to 'cin' is ambiguous cin >> x; ^ multiset_oop.cpp:8:10: note: candidates are: std::ifstream cin ifstream cin("multiset_oop.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from multiset_oop.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ multiset_oop.cpp:60:5: error: reference to 'cin' is ambiguous cin >> q; ^ multiset_oop.cpp:8:10: note: candidates are: std::ifstream cin ifstream cin("multiset_oop.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from multiset_oop.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ multiset_oop.cpp:63:9: error: reference to 'cin' is ambiguous cin >> op >> x; ^ multiset_oop.cpp:8:10: note: candidates are: std::ifstream cin ifstream cin("multiset_oop.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from multiset_oop.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ multiset_oop.cpp:68:14: error: reference to 'cout' is ambiguous else cout << ms.Find(x) << '\n'; ^ multiset_oop.cpp:9:10: note: candidates are: std::ofstream cout ofstream cout("multiset_oop.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from multiset_oop.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ multiset_oop.cpp: At global scope: multiset_oop.cpp:97:5: error: redefinition of 'int n' int n, q, op, x; ^ multiset_oop.cpp:50:5: error: 'int n' previously declared here int n, q, op, x; ^ multiset_oop.cpp:97:8: error: redefinition of 'int q' int n, q, op, x; ^ multiset_oop.cpp:50:8: error: 'int q' previously declared here int n, q, op, x; ^ multiset_oop.cpp:97:11: error: redefinition of 'int op' int n, q, op, x; ^ multiset_oop.cpp:50:11: error: 'int op' previously declared here int n, q, op, x; ^ multiset_oop.cpp:97:15: error: redefinition of 'int x' int n, q, op, x; ^ multiset_oop.cpp:50:15: error: 'int x' previously declared here int n, q, op, x; ^ multiset_oop.cpp: In function 'int main()': multiset_oop.cpp:98:5: error: redefinition of 'int main()' int main() ^ multiset_oop.cpp:51:5: error: 'int main()' previously defined here int main() ^ multiset_oop.cpp:119:5: error: reference to 'cout' is ambiguous cout << ms.Find(x); ^ multiset_oop.cpp:9:10: note: candidates are: std::ofstream cout ofstream cout("multiset_oop.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from multiset_oop.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ multiset_oop.cpp:100: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:101: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ă.