#939
sum00
Să se scrie un program care citeşte de la tastatura două numere naturale şi determină suma lor.
Problema | sum00 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #36854854 | Utilizator | |
Fișier | sum00.cpp | Dimensiune | 1.18 KB |
Data încărcării | 26 Mai 2022, 14:47 | Scor / rezultat | Eroare de compilare |
sum00.cpp: In function 'std::ostream& operator<<(std::ostream&, punct&)': sum00.cpp:33:5: warning: no return statement in function returning non-void [-Wreturn-type] } ^ sum00.cpp: In constructor 'segment::segment(punct&, punct&)': sum00.cpp:40:5: error: no matching function for call to 'punct::punct()' { ^ sum00.cpp:40:5: note: candidates are: sum00.cpp:9:5: note: punct::punct(int, int) punct(int cs, int cd) ^ sum00.cpp:9:5: note: candidate expects 2 arguments, 0 provided sum00.cpp:4:7: note: constexpr punct::punct(const punct&) class punct ^ sum00.cpp:4:7: note: candidate expects 1 argument, 0 provided sum00.cpp:40:5: error: no matching function for call to 'punct::punct()' { ^ sum00.cpp:40:5: note: candidates are: sum00.cpp:9:5: note: punct::punct(int, int) punct(int cs, int cd) ^ sum00.cpp:9:5: note: candidate expects 2 arguments, 0 provided sum00.cpp:4:7: note: constexpr punct::punct(const punct&) class punct ^ sum00.cpp:4:7: note: candidate expects 1 argument, 0 provided sum00.cpp:43:117: error: 'sqrt' was not declared in this scope this->l=sqrt((p2.get_x()-p1.get_x())*(p2.get_x()-p1.get_x())+(p2.get_y()-p1.get_y())*(p2.get_y()-p1.get_y())); ^ sum00.cpp: In function 'std::ostream& operator<<(std::ostream&, segment&)': sum00.cpp:48:5: warning: no return statement in function returning non-void [-Wreturn-type] } ^ sum00.cpp: In function 'int main()': sum00.cpp:54:10: error: 'n' was not declared in this scope cin>>n; ^ sum00.cpp:55:5: error: 'list' was not declared in this scope list<segment> L; ^ sum00.cpp:55:17: error: expected primary-expression before '>' token list<segment> L; ^ sum00.cpp:55:19: error: 'L' was not declared in this scope list<segment> L; ^ sum00.cpp:57:11: error: 'x1' was not declared in this scope {cin>>x1>>y1>>x2>>y2; ^ sum00.cpp:57:15: error: 'y1' was not declared in this scope {cin>>x1>>y1>>x2>>y2; ^ sum00.cpp:57:19: error: 'x2' was not declared in this scope {cin>>x1>>y1>>x2>>y2; ^ sum00.cpp:57:23: error: 'y2' was not declared in this scope {cin>>x1>>y1>>x2>>y2; ^ sum00.cpp:61:7: error: request for member 'push_back' in 'l', which is of non-class type 'double' l.push_back(s); ^ sum00.cpp:63:17: error: no matching function for call to 'begin(double&)' for(auto it:l) ^ sum00.cpp:63:17: note: candidates are: In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0, from /usr/include/c++/4.8/string:52, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sum00.cpp:1: /usr/include/c++/4.8/initializer_list:89:5: note: template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>) begin(initializer_list<_Tp> __ils) noexcept ^ /usr/include/c++/4.8/initializer_list:89:5: note: template argument deduction/substitution failed: sum00.cpp:63:17: note: mismatched types 'std::initializer_list<_Tp>' and 'double' for(auto it:l) ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sum00.cpp:1: /usr/include/c++/4.8/bits/range_access.h:87:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::begin(_Tp (&)[_Nm]) begin(_Tp (&__arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:87:5: note: template argument deduction/substitution failed: sum00.cpp:63:17: note: mismatched types '_Tp [_Nm]' and 'double' for(auto it:l) ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sum00.cpp:1: /usr/include/c++/4.8/bits/range_access.h:58:5: note: template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) begin(const _Container& __cont) -> decltype(__cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:58:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) [with _Container = double]': sum00.cpp:63:17: required from here /usr/include/c++/4.8/bits/range_access.h:58:5: error: request for member 'begin' in '__cont', which is of non-class type 'const double' /usr/include/c++/4.8/bits/range_access.h:48:5: note: template<class _Container> decltype (__cont.begin()) std::begin(_Container&) begin(_Container& __cont) -> decltype(__cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:48:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(_Container&) [with _Container = double]': sum00.cpp:63:17: required from here /usr/include/c++/4.8/bits/range_access.h:48:5: error: request for member 'begin' in '__cont', which is of non-class type 'double' sum00.cpp:63:17: error: no matching function for call to 'end(double&)' for(auto it:l) ^ sum00.cpp:63:17: note: candidates are: In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0, from /usr/include/c++/4.8/string:52, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sum00.cpp:1: /usr/include/c++/4.8/initializer_list:99:5: note: template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>) end(initializer_list<_Tp> __ils) noexcept ^ /usr/include/c++/4.8/initializer_list:99:5: note: template argument deduction/substitution failed: sum00.cpp:63:17: note: mismatched types 'std::initializer_list<_Tp>' and 'double' for(auto it:l) ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sum00.cpp:1: /usr/include/c++/4.8/bits/range_access.h:97:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm]) end(_Tp (&__arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:97:5: note: template argument deduction/substitution failed: sum00.cpp:63:17: note: mismatched types '_Tp [_Nm]' and 'double' for(auto it:l) ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sum00.cpp:1: /usr/include/c++/4.8/bits/range_access.h:78:5: note: template<class _Container> decltype (__cont.end()) std::end(const _Container&) end(const _Container& __cont) -> decltype(__cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:78:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(const _Container&) [with _Container = double]': sum00.cpp:63:17: required from here /usr/include/c++/4.8/bits/range_access.h:78:5: error: request for member 'end' in '__cont', which is of non-class type 'const double' /usr/include/c++/4.8/bits/range_access.h:68:5: note: template<class _Container> decltype (__cont.end()) std::end(_Container&) end(_Container& __cont) -> decltype(__cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:68:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(_Container&) [with _Container = double]': sum00.cpp:63:17: required from here /usr/include/c++/4.8/bits/range_access.h:68:5: error: request for member 'end' in '__cont', which is of non-class type 'double' sum00.cpp:52:9: warning: unused variable 'x' [-Wunused-variable] int x,y; ^ sum00.cpp:52:11: warning: unused variable 'y' [-Wunused-variable] int x,y; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sum00 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ă.