#509
Să se scrie un program care ordonează crescător elementele unui vector.
| Problema | Ordonare | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64493871 | Utilizator | |
| Fișier | ordonare.cpp | Dimensiune | 285 B |
| Data încărcării | 11 Mai 2026, 09:53 | Scor/rezultat | Eroare de compilare |
ordonare.cpp: In function ‘int main()’: ordonare.cpp:7:13: error: found ‘:’ in nested-name-specifier, expected ‘::’ 7 | ios base:n,i; | ^ | :: ordonare.cpp:7:9: error: ‘base’ has not been declared 7 | ios base:n,i; | ^~~~ ordonare.cpp:7:15: error: qualified-id in declaration before ‘,’ token 7 | ios base:n,i; | ^ ordonare.cpp:7:16: error: ‘std::basic_ios<_CharT, _Traits>::basic_ios() [with _CharT = char; _Traits = std::char_traits<char>]’ is protected within this context 7 | ios base:n,i; | ^ In file included from /usr/include/c++/13/ios:46, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from ordonare.cpp:1: /usr/include/c++/13/bits/basic_ios.h:460:7: note: declared protected here 460 | basic_ios() | ^~~~~~~~~ ordonare.cpp:8:10: error: ‘n’ was not declared in this scope 8 | cin>>n; | ^ ordonare.cpp:9:11: error: no match for ‘operator=’ (operand types are ‘std::ios’ {aka ‘std::basic_ios<char>’} and ‘int’) 9 | for(i=0;i<n;i++) | ^ /usr/include/c++/13/bits/basic_ios.h:476:18: note: candidate: ‘std::basic_ios<_CharT, _Traits>& std::basic_ios<_CharT, _Traits>::operator=(const std::basic_ios<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits<char>]’ (deleted) 476 | basic_ios& operator=(const basic_ios&) = delete; | ^~~~~~~~ /usr/include/c++/13/bits/basic_ios.h:476:28: note: no known conversion for argument 1 from ‘int’ to ‘const std::basic_ios<char>&’ 476 | basic_ios& operator=(const basic_ios&) = delete; | ^~~~~~~~~~~~~~~~ ordonare.cpp:9:18: error: no ‘operator++(int)’ declared for postfix ‘++’ [-fpermissive] 9 | for(i=0;i<n;i++) | ~^~ ordonare.cpp:11:15: error: no match for ‘operator[]’ (operand types are ‘long long int [1001]’ and ‘std::ios’ {aka ‘std::basic_ios<char>’}) 11 | cin>>v[i]; | ^ ordonare.cpp:11:15: note: candidate: ‘operator[](long long int*, long int)’ (built-in) ordonare.cpp:11:15: note: no known conversion for argument 2 from ‘std::ios’ {aka ‘std::basic_ios<char>’} to ‘long int’ ordonare.cpp:14:11: error: no match for ‘operator=’ (operand types are ‘std::ios’ {aka ‘std::basic_ios<char>’} and ‘int’) 14 | for(i=0;i<n;i++) | ^ /usr/include/c++/13/bits/basic_ios.h:476:18: note: candidate: ‘std::basic_ios<_CharT, _Traits>& std::basic_ios<_CharT, _Traits>::operator=(const std::basic_ios<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits<char>]’ (deleted) 476 | basic_ios& operator=(const basic_ios&) = delete; | ^~~~~~~~ /usr/include/c++/13/bits/basic_ios.h:476:28: note: no known conversion for argument 1 from ‘int’ to ‘const std::basic_ios<char>&’ 476 | basic_ios& operator=(const basic_ios&) = delete; | ^~~~~~~~~~~~~~~~ ordonare.cpp:14:18: error: no ‘operator++(int)’ declared for postfix ‘++’ [-fpermissive] 14 | for(i=0;i<n;i++) | ~^~ ordonare.cpp:16:16: error: no match for ‘operator[]’ (operand types are ‘long long int [1001]’ and ‘std::ios’ {aka ‘std::basic_ios<char>’}) 16 | cout<<v[i]<<" "; | ^ ordonare.cpp:16:16: note: candidate: ‘operator[](long long int*, long int)’ (built-in) ordonare.cpp:16:16: note: no known conversion for argument 2 from ‘std::ios’ {aka ‘std::basic_ios<char>’} to ‘long int’
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Ordonare 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ă.