#1
sum
Să se scrie un program care citeşte din fişier două numere întregi şi determină suma lor.
Problema | sum | Operații I/O |
sum.in /sum.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #5427050 | Utilizator | |
Fișier | sum.cpp | Dimensiune | 3.93 KB |
Data încărcării | 11 Iulie 2017, 11:03 | Scor / rezultat | Eroare de compilare |
sum.cpp: In function 'void citire(complexe&)': sum.cpp:19:10: error: cannot bind 'std::istream {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' cin>>a ^ In file included from /usr/include/c++/4.8/iostream:40:0, from sum.cpp:4: /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 = complexe]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ sum.cpp:20:1: error: expected ';' before '}' token } ^ sum.cpp: In function 'void afisare1(complexe)': sum.cpp:28:6: error: 'i' was not declared in this scope if(a[i].im<0) cout<<a[i].re<<a[i].im<<"i"<<endl;/// afisam numarul complex ^ sum.cpp: At global scope: sum.cpp:96:1: error: expected unqualified-id before '{' token { ^ sum.cpp: In function 'int main()': sum.cpp:123:15: error: invalid initialization of reference of type 'complexe&' from expression of type 'int' citire(n,a); ^ sum.cpp:12:6: error: in passing argument 1 of 'void citire(complexe&)' void citire(complexe &a) ^ sum.cpp:124:11: error: no match for 'operator[]' (operand types are 'complexe' and 'int') conjugat(a[1].re,a[1].im); ^ sum.cpp:124:19: error: no match for 'operator[]' (operand types are 'complexe' and 'int') conjugat(a[1].re,a[1].im); ^ sum.cpp:125:17: error: 'afisare2' was not declared in this scope afisare2(n,a); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sum 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ă.