#927
Se dau coordonatele în plan a două puncte. Să se afișeze pătratul distanței dintre ele.
Problema | DistantaPuncte | Operații I/O |
![]() distantapuncte.in /distantapuncte.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58090790 | Utilizator | |
Fișier | distantapuncte.cpp | Dimensiune | 458 B |
Data încărcării | 13 Mai 2025, 17:18 | Scor / rezultat | Eroare de compilare |
distantapuncte.cpp:8:11: error: 'int y1' redeclared as different kind of symbol int x1,x2,y1,y2; ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iosfwd:38, from /usr/include/c++/4.8/ios:38, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from distantapuncte.cpp:1: /usr/include/i386-linux-gnu/bits/mathcalls.h:241:1: error: previous declaration of 'double y1(double)' __MATHCALL (y1,, (_Mdouble_)); ^ distantapuncte.cpp: In function 'void citeste()': distantapuncte.cpp:12:12: error: 'n' was not declared in this scope cin >> n; ^ distantapuncte.cpp:14:16: error: 'x' was not declared in this scope cin >> x[i] >> y[i]; ^ distantapuncte.cpp:14:24: error: 'y' was not declared in this scope cin >> x[i] >> y[i]; ^ distantapuncte.cpp: In function 'float dist(int, int)': distantapuncte.cpp:19:31: error: invalid operands of types 'int' and 'double(double)throw ()' to binary 'operator-' d = pow(x2-x1,2) + pow(y2-y1,2)); ^ distantapuncte.cpp:19:36: error: expected ';' before ')' token d = pow(x2-x1,2) + pow(y2-y1,2)); ^ distantapuncte.cpp: In function 'int main()': distantapuncte.cpp:25:9: error: cannot bind 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' cin >> x1 >> y1 >> x2 >> y2; ^ In file included from /usr/include/c++/4.8/fstream:38:0, from distantapuncte.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = double(double)throw ()]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ distantapuncte.cpp:26:29: error: invalid conversion from 'double (*)(double)throw ()' to 'int' [-fpermissive] cout << dist(x1,y1,x2,y2); ^ distantapuncte.cpp:26:29: error: too many arguments to function 'float dist(int, int)' distantapuncte.cpp:17:7: note: declared here float dist(int x, int y){ ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema DistantaPuncte 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ă.