#9
Să se scrie un program care citeşte de la tastatură trei numere naturale și determină diferenţa dintre cel mai mare şi cel mai mic.
| Problema | maxmin | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64236845 | Utilizator | |
| Fișier | maxmin.cpp | Dimensiune | 263 B |
| Data încărcării | 24 Aprilie 2026, 14:38 | Scor/rezultat | Eroare de compilare |
maxmin.cpp:3:1: error: extended character is not valid in an identifier 3 | using namespace std; | ^ maxmin.cpp:3:1: error: extended character is not valid in an identifier maxmin.cpp:4:1: error: extended character is not valid in an identifier 4 | int main() | ^ maxmin.cpp:6:5: error: extended character is not valid in an identifier 6 | int a,b,c, maxim, minim; | ^ maxmin.cpp:9:1: error: extended character is not valid in an identifier 9 | if (b>max) | ^ maxmin.cpp:11:1: error: extended character is not valid in an identifier 11 | if (c>max) | ^ maxmin.cpp:12:11: error: extended character is not valid in an identifier 12 | maxim = c; | ^ maxmin.cpp:14:1: error: extended character is not valid in an identifier 14 | if (b<min) | ^ maxmin.cpp:16:1: error: extended character is not valid in an identifier 16 | if (c<min) | ^ maxmin.cpp:19:1: error: extended character is not valid in an identifier 19 | return 0; | ^ maxmin.cpp:3:1: error: ‘using namespace std’ does not name a type 3 | using namespace std; | ^~~~~~~~~~~~~~~~~~~ maxmin.cpp:4:1: error: ISO C++ forbids declaration of ‘int main’ with no type [-fpermissive] 4 | int main() | ^~~~~~~~ maxmin.cpp: In function ‘int int main()’: maxmin.cpp:6:5: error: ‘int a’ was not declared in this scope; did you mean ‘int main’? 6 | int a,b,c, maxim, minim; | ^~~~~ | int main maxmin.cpp:6:11: error: ‘b’ was not declared in this scope 6 | int a,b,c, maxim, minim; | ^ maxmin.cpp:6:13: error: ‘c’ was not declared in this scope 6 | int a,b,c, maxim, minim; | ^ maxmin.cpp:6:16: error: ‘maxim’ was not declared in this scope 6 | int a,b,c, maxim, minim; | ^~~~~ maxmin.cpp:6:23: error: ‘minim’ was not declared in this scope 6 | int a,b,c, maxim, minim; | ^~~~~ maxmin.cpp:7:1: error: ‘cin’ was not declared in this scope; did you mean ‘std::cin’? 7 | cin >>a>>b>>c; | ^~~ | std::cin In file included from maxmin.cpp:2: /usr/include/c++/13/iostream:62:18: note: ‘std::cin’ declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ maxmin.cpp:7:7: error: ‘a’ was not declared in this scope 7 | cin >>a>>b>>c; | ^ maxmin.cpp:9:7: error: ‘max’ was not declared in this scope; did you mean ‘std::max’? 9 | if (b>max) | ^~~ | std::max In file included from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41: /usr/include/c++/13/bits/stl_algobase.h:303:5: note: ‘std::max’ declared here 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ maxmin.cpp:9:1: error: ‘if ’ was not declared in this scope 9 | if (b>max) | ^~~ maxmin.cpp:12:11: error: ‘ ’ was not declared in this scope 12 | maxim = c; | ^ maxmin.cpp:14:7: error: ‘min’ was not declared in this scope; did you mean ‘std::min’? 14 | if (b<min) | ^~~ | std::min /usr/include/c++/13/bits/stl_algobase.h:281:5: note: ‘std::min’ declared here 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ maxmin.cpp:18:1: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’? 18 | cout << max-min; | ^~~~ | std::cout /usr/include/c++/13/iostream:63:18: note: ‘std::cout’ declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ maxmin.cpp:19:1: error: ‘return 0’ was not declared in this scope 19 | return 0; | ^~~~~~~~ maxmin.cpp:20:1: warning: no return statement in function returning non-void [-Wreturn-type] 20 | } | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema maxmin 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ă.