#180
Să se ordoneze crescător elementele dintr-un şir dat cuprinse între elementul de valoare maximă şi cel de valoare minimă.
Problema | sortMinMax | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #56302146 | Utilizator | |
Fișier | sortminmax.cpp | Dimensiune | 765 B |
Data încărcării | 13 Februarie 2025, 09:21 | Scor / rezultat | Eroare de compilare |
sortminmax.cpp: In function 'int main()': sortminmax.cpp:8:5: error: reference to 'max' is ambiguous max=v[1]; ^ sortminmax.cpp:3:28: note: candidates are: int max int n, v[1001], min, pmin, max, pmax,i ; ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sortminmax.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ sortminmax.cpp:9:5: error: reference to 'min' is ambiguous min=v[1]; ^ sortminmax.cpp:3:17: note: candidates are: int min int n, v[1001], min, pmin, max, pmax,i ; ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sortminmax.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ sortminmax.cpp:13:9: error: reference to 'max' is ambiguous if (max<v[i]){ ^ sortminmax.cpp:3:28: note: candidates are: int max int n, v[1001], min, pmin, max, pmax,i ; ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sortminmax.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ sortminmax.cpp:14:10: error: reference to 'max' is ambiguous max=v[i]; ^ sortminmax.cpp:3:28: note: candidates are: int max int n, v[1001], min, pmin, max, pmax,i ; ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sortminmax.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ sortminmax.cpp:17:9: error: reference to 'min' is ambiguous if (min>v[i]){ ^ sortminmax.cpp:3:17: note: candidates are: int min int n, v[1001], min, pmin, max, pmax,i ; ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sortminmax.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ sortminmax.cpp:18:9: error: reference to 'min' is ambiguous min=v[i]; ^ sortminmax.cpp:3:17: note: candidates are: int min int n, v[1001], min, pmin, max, pmax,i ; ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sortminmax.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ sortminmax.cpp:29:9: error: 'ok' was not declared in this scope ok=0; ^ sortminmax.cpp:31:9: error: 'aux1' was not declared in this scope aux1=v[i]; ^ sortminmax.cpp:33:16: error: 'aux1' was not declared in this scope v[i+1]=aux1; ^ sortminmax.cpp:36:13: error: expected 'while' before '(' token for (i=1; i<=n; i++) ^ sortminmax.cpp:36:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses] for (i=1; i<=n; i++) ^ sortminmax.cpp:36:17: error: expected ')' before ';' token for (i=1; i<=n; i++) ^ sortminmax.cpp:36:20: warning: statement has no effect [-Wunused-value] for (i=1; i<=n; i++) ^ sortminmax.cpp:36:28: error: expected ';' before ')' token for (i=1; i<=n; i++) ^ sortminmax.cpp:39:13: error: 'ok' was not declared in this scope if (ok==1) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sortMinMax 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ă.