#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 | #64811718 | Utilizator | |
| Fișier | maxmin.cpp | Dimensiune | 346 B |
| Data încărcării | 02 Iunie 2026, 21:16 | Scor/rezultat | Eroare de compilare |
maxmin.cpp: In function ‘int main()’: maxmin.cpp:9:9: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses] 9 | if(a>b>c) | ~^~ maxmin.cpp:10:20: error: no match for ‘operator=’ (operand types are ‘std::basic_ostream<char>’ and ‘int’) 10 | cout<<mn=a-c; | ^ In file included from /usr/include/c++/13/iostream:41, from maxmin.cpp:1: /usr/include/c++/13/ostream:449:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]’ 449 | operator=(basic_ostream&& __rhs) | ^~~~~~~~ /usr/include/c++/13/ostream:449:33: note: no known conversion for argument 1 from ‘int’ to ‘std::basic_ostream<char>&&’ 449 | operator=(basic_ostream&& __rhs) | ~~~~~~~~~~~~~~~~^~~~~ maxmin.cpp:11:9: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses] 11 | if(c>a>b) | ~^~ maxmin.cpp:12:20: error: no match for ‘operator=’ (operand types are ‘std::basic_ostream<char>’ and ‘int’) 12 | cout<<mn=c-b; | ^ /usr/include/c++/13/ostream:449:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]’ 449 | operator=(basic_ostream&& __rhs) | ^~~~~~~~ /usr/include/c++/13/ostream:449:33: note: no known conversion for argument 1 from ‘int’ to ‘std::basic_ostream<char>&&’ 449 | operator=(basic_ostream&& __rhs) | ~~~~~~~~~~~~~~~~^~~~~ maxmin.cpp:13:9: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses] 13 | if(b>c>a) | ~^~ maxmin.cpp:14:20: error: no match for ‘operator=’ (operand types are ‘std::basic_ostream<char>’ and ‘int’) 14 | cout<<mn=b-a; | ^ /usr/include/c++/13/ostream:449:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]’ 449 | operator=(basic_ostream&& __rhs) | ^~~~~~~~ /usr/include/c++/13/ostream:449:33: note: no known conversion for argument 1 from ‘int’ to ‘std::basic_ostream<char>&&’ 449 | operator=(basic_ostream&& __rhs) | ~~~~~~~~~~~~~~~~^~~~~ maxmin.cpp:15:9: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses] 15 | if(a>c>b) | ~^~ maxmin.cpp:16:20: error: no match for ‘operator=’ (operand types are ‘std::basic_ostream<char>’ and ‘int’) 16 | cout<<mn=a-b; | ^ /usr/include/c++/13/ostream:449:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]’ 449 | operator=(basic_ostream&& __rhs) | ^~~~~~~~ /usr/include/c++/13/ostream:449:33: note: no known conversion for argument 1 from ‘int’ to ‘std::basic_ostream<char>&&’ 449 | operator=(basic_ostream&& __rhs) | ~~~~~~~~~~~~~~~~^~~~~ maxmin.cpp:17:9: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses] 17 | if(b>a>c) | ~^~ maxmin.cpp:18:20: error: no match for ‘operator=’ (operand types are ‘std::basic_ostream<char>’ and ‘int’) 18 | cout<<mn=b-c; | ^ /usr/include/c++/13/ostream:449:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]’ 449 | operator=(basic_ostream&& __rhs) | ^~~~~~~~ /usr/include/c++/13/ostream:449:33: note: no known conversion for argument 1 from ‘int’ to ‘std::basic_ostream<char>&&’ 449 | operator=(basic_ostream&& __rhs) | ~~~~~~~~~~~~~~~~^~~~~ maxmin.cpp:19:9: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses] 19 | if(c>b>a) | ~^~ maxmin.cpp:20:20: error: no match for ‘operator=’ (operand types are ‘std::basic_ostream<char>’ and ‘int’) 20 | cout<<mn=c-a; | ^ /usr/include/c++/13/ostream:449:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]’ 449 | operator=(basic_ostream&& __rhs) | ^~~~~~~~ /usr/include/c++/13/ostream:449:33: note: no known conversion for argument 1 from ‘int’ to ‘std::basic_ostream<char>&&’ 449 | operator=(basic_ostream&& __rhs) | ~~~~~~~~~~~~~~~~^~~~~
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ă.