#1
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 | #59920319 | Utilizator | |
| Fișier | sum.cpp | Dimensiune | 4.22 KB |
| Data încărcării | 13 Octombrie 2025, 12:51 | Scor/rezultat | Eroare de compilare |
sum.cpp:1:7: error: expected nested-name-specifier before 'System' using System; ^ sum.cpp:1:7: error: 'System' has not been declared sum.cpp:2:7: error: expected nested-name-specifier before 'System' using System.Collections.Generic; ^ sum.cpp:2:7: error: 'System' has not been declared sum.cpp:2:13: error: expected ';' before '.' token using System.Collections.Generic; ^ sum.cpp:2:13: error: expected unqualified-id before '.' token sum.cpp:3:7: error: expected nested-name-specifier before 'System' using System.Linq; ^ sum.cpp:3:7: error: 'System' has not been declared sum.cpp:3:13: error: expected ';' before '.' token using System.Linq; ^ sum.cpp:3:13: error: expected unqualified-id before '.' token sum.cpp:4:7: error: expected nested-name-specifier before 'System' using System.Text; ^ sum.cpp:4:7: error: 'System' has not been declared sum.cpp:4:13: error: expected ';' before '.' token using System.Text; ^ sum.cpp:4:13: error: expected unqualified-id before '.' token sum.cpp:5:7: error: expected nested-name-specifier before 'System' using System.Threading.Tasks; ^ sum.cpp:5:7: error: 'System' has not been declared sum.cpp:5:13: error: expected ';' before '.' token using System.Threading.Tasks; ^ sum.cpp:5:13: error: expected unqualified-id before '.' token sum.cpp:11:16: error: expected ':' before 'int' public int i; ^ sum.cpp:12:16: error: expected ':' before 'int' public int r; ^ sum.cpp:13:16: error: expected ':' before 'Complex' public Complex(int pr, int pl) ^ sum.cpp:18:16: error: expected ':' before 'Complex' public Complex() ^ sum.cpp:23:16: error: expected ':' before 'double' public double modul() ^ sum.cpp:28:16: error: expected ':' before 'void' public void set(int pr, int pl) ^ sum.cpp:33:16: error: expected ':' before 'int' public int real() ^ sum.cpp:37:16: error: expected ':' before 'int' public int imag() ^ sum.cpp:41:16: error: expected ':' before 'static' public static Complex operator +(Complex z1, Complex z2) ^ sum.cpp:41:64: error: 'static coolboy::Complex coolboy::Complex::operator+(coolboy::Complex, coolboy::Complex)' must be either a non-static member function or a non-member function public static Complex operator +(Complex z1, Complex z2) ^ sum.cpp:46:16: error: expected ':' before 'static' public static Complex operator -(Complex z1, Complex z2) ^ sum.cpp:46:64: error: 'static coolboy::Complex coolboy::Complex::operator-(coolboy::Complex, coolboy::Complex)' must be either a non-static member function or a non-member function public static Complex operator -(Complex z1, Complex z2) ^ sum.cpp:51:16: error: expected ':' before 'static' public static Complex operator *(Complex z1, Complex z2) ^ sum.cpp:51:64: error: 'static coolboy::Complex coolboy::Complex::operator*(coolboy::Complex, coolboy::Complex)' must be either a non-static member function or a non-member function public static Complex operator *(Complex z1, Complex z2) ^ sum.cpp:56:16: error: expected ':' before 'string' public string afisare() ^ sum.cpp:56:16: error: 'string' does not name a type sum.cpp:77:16: error: expected ':' before 'static' public static bool operator <(Complex z1, Complex z2) ^ sum.cpp:77:61: error: 'static bool coolboy::Complex::operator<(coolboy::Complex, coolboy::Complex)' must be either a non-static member function or a non-member function public static bool operator <(Complex z1, Complex z2) ^ sum.cpp:86:16: error: expected ':' before 'static' public static bool operator >(Complex z1, Complex z2) ^ sum.cpp:86:61: error: 'static bool coolboy::Complex::operator>(coolboy::Complex, coolboy::Complex)' must be either a non-static member function or a non-member function public static bool operator >(Complex z1, Complex z2) ^ sum.cpp:95:16: error: expected ':' before 'static' public static bool operator ==(Complex z1, Complex z2) ^ sum.cpp:95:62: error: 'static bool coolboy::Complex::operator==(coolboy::Complex, coolboy::Complex)' must be either a non-static member function or a non-member function public static bool operator ==(Complex z1, Complex z2) ^ sum.cpp:104:16: error: expected ':' before 'static' public static bool operator !=(Complex z1, Complex z2) ^ sum.cpp:104:62: error: 'static bool coolboy::Complex::operator!=(coolboy::Complex, coolboy::Complex)' must be either a non-static member function or a non-member function public static bool operator !=(Complex z1, Complex z2) ^ sum.cpp:113:5: error: expected ';' after class definition } ^ sum.cpp: In member function 'double coolboy::Complex::modul()': sum.cpp:25:24: error: 'Math' was not declared in this scope double z = Math.Sqrt(r * r + i * i); ^ sum.cpp: At global scope: sum.cpp:116:16: error: expected ':' before 'Real' public Real ^ sum.cpp:117:5: error: expected unqualified-id before '}' token } ^ sum.cpp:117:5: error: expected ';' after class definition sum.cpp:120:26: error: 'string' has not been declared static void Main(string[] args) ^ sum.cpp:120:35: error: expected ',' or '...' before 'args' static void Main(string[] args) ^ sum.cpp:160:5: error: expected ';' after class definition } ^ sum.cpp: In static member function 'static void coolboy::Program::Main(int*)': sum.cpp:132:20: error: expected unqualified-id before '[' token Complex[] v = new Complex[101]; ^ sum.cpp:133:21: error: expected primary-expression before 'int' int n = int.Parse(Console.ReadLine()); ^ sum.cpp:137:17: error: 'string' was not declared in this scope string[] cit = Console.ReadLine().Split(' '); ^ sum.cpp:137:24: error: expected primary-expression before ']' token string[] cit = Console.ReadLine().Split(' '); ^ sum.cpp:137:26: error: expected ';' before 'cit' string[] cit = Console.ReadLine().Split(' '); ^ sum.cpp:138:28: error: expected primary-expression before 'int' int imag = int.Parse(cit[1]); ^ sum.cpp:139:28: error: expected primary-expression before 'int' int real = int.Parse(cit[0]); ^ sum.cpp:140:51: error: conversion from 'coolboy::Complex*' to non-scalar type 'coolboy::Complex' requested Complex z = new Complex(real, imag); ^ sum.cpp:141:17: error: 'v' was not declared in this scope v[i] = z; ^ sum.cpp:148:24: error: 'v' was not declared in this scope if(v[i]>v[j]) ^
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ă.