#900
OrdonareF1
C++
Scrieţi definiția completă a subprogramului C++ ordonare
care are 2
parametri: a
, prin care primeşte un tablou unidimensional cu maximum 1000
de numere naturale mai mici decât 1.000.000.000
și n
, numărul efectiv de elemente ale tabloului.
Subprogramul ordonează descrescător elementele tabloului a
, fără a returna valori.
Problema | OrdonareF1 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53206555 | Utilizator | |
Fișier | ordonaref1.cpp | Dimensiune | 153 B |
Data încărcării | 21 Octombrie 2024, 12:36 | Scor / rezultat | Eroare de compilare |
ordonaref1.cpp:4:28: error: 'n' has not been declared void orodnare (int a[1001],n) ^ ordonaref1.cpp: In function 'void orodnare(int*, int)': ordonaref1.cpp:6:19: error: 'n' was not declared in this scope for(int i=0;i<n-1;i++) ^ ordonaref1.cpp:9:27: error: no matching function for call to 'swap(bool)' swap(a[i]>a[j]) ^ ordonaref1.cpp:9:27: note: candidates are: In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0, from /usr/include/c++/4.8/bits/stl_algobase.h:64, from /usr/include/c++/4.8/bits/char_traits.h:39, 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 ordonaref1.cpp:1: /usr/include/c++/4.8/bits/move.h:166:5: note: template<class _Tp> void std::swap(_Tp&, _Tp&) swap(_Tp& __a, _Tp& __b) ^ /usr/include/c++/4.8/bits/move.h:166:5: note: template argument deduction/substitution failed: ordonaref1.cpp:9:27: note: candidate expects 2 arguments, 1 provided swap(a[i]>a[j]) ^ In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0, from /usr/include/c++/4.8/bits/stl_algobase.h:64, from /usr/include/c++/4.8/bits/char_traits.h:39, 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 ordonaref1.cpp:1: /usr/include/c++/4.8/bits/move.h:185:5: note: template<class _Tp, unsigned int _Nm> void std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm]) swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) ^ /usr/include/c++/4.8/bits/move.h:185:5: note: template argument deduction/substitution failed: ordonaref1.cpp:9:27: note: mismatched types '_Tp [_Nm]' and 'bool' swap(a[i]>a[j]) ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, 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 ordonaref1.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:254:5: note: template<class _T1, class _T2> void std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&) swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) ^ /usr/include/c++/4.8/bits/stl_pair.h:254:5: note: template argument deduction/substitution failed: ordonaref1.cpp:9:27: note: mismatched types 'std::pair<_T1, _T2>' and 'bool' swap(a[i]>a[j]) ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from ordonaref1.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: template<class _CharT, class _Traits, class _Alloc> void std::swap(std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>&) swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: template argument deduction/substitution failed: ordonaref1.cpp:9:27: note: mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'bool' swap(a[i]>a[j]) ^ ordonaref1.cpp:12:1: error: expected ';' before '}' token } ^ ordonaref1.cpp: In function 'int main()': ordonaref1.cpp:20:14: error: 'ordonare' was not declared in this scope ordonare(a,n); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema OrdonareF1 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ă.