#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 |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64730253 | Utilizator | |
| Fișier | sortminmax.cpp | Dimensiune | 756 B |
| Data încărcării | 26 Mai 2026, 14:24 | Scor/rezultat | Eroare de compilare |
sortminmax.cpp: In function ‘int main()’: sortminmax.cpp:7:34: error: ‘INT_MAX’ was not declared in this scope 7 | int X[1001],n,i,j,aux, minim=INT_MAX, maxim=INT_MIN, p1, p2; | ^~~~~~~ sortminmax.cpp:2:1: note: ‘INT_MAX’ is defined in header ‘<climits>’; did you forget to ‘#include <climits>’? 1 | #include <iostream> +++ |+#include <climits> 2 | sortminmax.cpp:13:14: warning: left operand of comma operator has no effect [-Wunused-value] 13 | for(i=1;i<=n,i++) | ~^~~ sortminmax.cpp:13:21: error: expected ‘;’ before ‘)’ token 13 | for(i=1;i<=n,i++) | ^ | ; sortminmax.cpp:18:13: error: ‘p1’ was not declared in this scope 18 | p1=i; | ^~ sortminmax.cpp:20:12: error: ‘maxim’ was not declared in this scope 20 | if(maxim<X[i]) | ^~~~~ sortminmax.cpp:23:13: error: ‘p2’ was not declared in this scope 23 | p2=i | ^~ sortminmax.cpp:26:17: error: ‘p1’ was not declared in this scope 26 | for(int i = p1 ; i <= p2-1 ; i ++) | ^~ sortminmax.cpp:26:27: error: ‘p2’ was not declared in this scope 26 | for(int i = p1 ; i <= p2-1 ; i ++) | ^~ sortminmax.cpp:26:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 26 | for(int i = p1 ; i <= p2-1 ; i ++) | ^~~ sortminmax.cpp:34:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 34 | for(i=p1; i<=p2; i++) | ^~~ sortminmax.cpp:34:15: error: ‘p1’ was not declared in this scope 34 | for(i=p1; i<=p2; i++) | ^~ sortminmax.cpp:34:22: error: ‘p2’ was not declared in this scope 34 | for(i=p1; i<=p2; i++) | ^~ sortminmax.cpp:7:21: warning: unused variable ‘j’ [-Wunused-variable] 7 | int X[1001],n,i,j,aux, minim=INT_MAX, maxim=INT_MIN, p1, p2; | ^ sortminmax.cpp:7:23: warning: unused variable ‘aux’ [-Wunused-variable] 7 | int X[1001],n,i,j,aux, minim=INT_MAX, maxim=INT_MIN, p1, p2; | ^~~
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ă.