#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 | #64236762 | Utilizator | |
| Fișier | maxmin.cpp | Dimensiune | 240 B |
| Data încărcării | 24 Aprilie 2026, 14:32 | Scor/rezultat | Eroare de compilare |
maxmin.cpp:2:1: error: extended character is not valid in an identifier 2 | using namespace std; | ^ maxmin.cpp:2:1: error: extended character is not valid in an identifier maxmin.cpp:3:1: error: extended character is not valid in an identifier 3 | int main() | ^ maxmin.cpp:5:2: error: extended character is not valid in an identifier 5 | .int a,b,c, max, min; | ^ maxmin.cpp:8:1: error: extended character is not valid in an identifier 8 | if (b>max) | ^ maxmin.cpp:10:1: error: extended character is not valid in an identifier 10 | if (c>max) | ^ maxmin.cpp:11:9: error: extended character is not valid in an identifier 11 | max = c; | ^ maxmin.cpp:13:1: error: extended character is not valid in an identifier 13 | if (b<min) | ^ maxmin.cpp:15:1: error: extended character is not valid in an identifier 15 | if (c<min) | ^ maxmin.cpp:18:1: error: extended character is not valid in an identifier 18 | return 0; | ^ maxmin.cpp:2:1: error: ‘using namespace std’ does not name a type 2 | using namespace std; | ^~~~~~~~~~~~~~~~~~~ maxmin.cpp:3:1: error: ISO C++ forbids declaration of ‘int main’ with no type [-fpermissive] 3 | int main() | ^~~~~~~~ maxmin.cpp: In function ‘int int main()’: maxmin.cpp:5:1: error: expected primary-expression before ‘.’ token 5 | .int a,b,c, max, min; | ^ maxmin.cpp:5:8: error: ‘b’ was not declared in this scope 5 | .int a,b,c, max, min; | ^ maxmin.cpp:5:10: error: ‘c’ was not declared in this scope 5 | .int a,b,c, max, min; | ^ maxmin.cpp:5:13: error: ‘max’ was not declared in this scope; did you mean ‘std::max’? 5 | .int a,b,c, max, min; | ^~~ | 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, from maxmin.cpp:1: /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:5:18: error: ‘min’ was not declared in this scope; did you mean ‘std::min’? 5 | .int a,b,c, max, 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:6:1: error: ‘cin’ was not declared in this scope; did you mean ‘std::cin’? 6 | cin >>a>>b>>c; | ^~~ | std::cin /usr/include/c++/13/iostream:62:18: note: ‘std::cin’ declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ maxmin.cpp:6:7: error: ‘a’ was not declared in this scope 6 | cin >>a>>b>>c; | ^ maxmin.cpp:8:1: error: ‘if ’ was not declared in this scope 8 | if (b>max) | ^~~ maxmin.cpp:11:9: error: ‘ ’ was not declared in this scope 11 | max = c; | ^ maxmin.cpp:17:1: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’? 17 | 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:18:1: error: ‘return 0’ was not declared in this scope 18 | return 0; | ^~~~~~~~ maxmin.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type] 19 | } | ^
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ă.