#2
suma_n
Să se scrie un program care citeşte de la tastatură un şir de numere naturale şi determină suma lor.
Problema | suma_n | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #30892421 | Utilizator | |
Fișier | suma_n.cpp | Dimensiune | 2.19 KB |
Data încărcării | 24 Septembrie 2021, 12:06 | Scor / rezultat | Eroare de compilare |
suma_n.cpp:3:7: error: expected nested-name-specifier before 'System' using System; ^ suma_n.cpp:3:7: error: 'System' has not been declared suma_n.cpp:4:7: error: expected nested-name-specifier before 'System' using System.Collections.Generic; ^ suma_n.cpp:4:7: error: 'System' has not been declared suma_n.cpp:4:13: error: expected ';' before '.' token using System.Collections.Generic; ^ suma_n.cpp:4:13: error: expected unqualified-id before '.' token suma_n.cpp:5:7: error: expected nested-name-specifier before 'System' using System.Linq; ^ suma_n.cpp:5:7: error: 'System' has not been declared suma_n.cpp:5:13: error: expected ';' before '.' token using System.Linq; ^ suma_n.cpp:5:13: error: expected unqualified-id before '.' token suma_n.cpp:6:7: error: expected nested-name-specifier before 'System' using System.Text; ^ suma_n.cpp:6:7: error: 'System' has not been declared suma_n.cpp:6:13: error: expected ';' before '.' token using System.Text; ^ suma_n.cpp:6:13: error: expected unqualified-id before '.' token suma_n.cpp:7:7: error: expected nested-name-specifier before 'System' using System.Threading.Tasks; ^ suma_n.cpp:7:7: error: 'System' has not been declared suma_n.cpp:7:13: error: expected ';' before '.' token using System.Threading.Tasks; ^ suma_n.cpp:7:13: error: expected unqualified-id before '.' token suma_n.cpp:13:26: error: 'string' has not been declared static void Main(string[] args) ^ suma_n.cpp:13:35: error: expected ',' or '...' before 'args' static void Main(string[] args) ^ suma_n.cpp:76:5: error: expected ';' after class definition } ^ suma_n.cpp: In static member function 'static void p05_matrice::Program::Main(int*)': suma_n.cpp:28:16: error: expected unqualified-id before '[' token int[] t = new int[] { 4, 1, 6, 2, 7 }; ^ suma_n.cpp:29:22: error: expected primary-expression before 'int' foreach (int e in t) ^ suma_n.cpp:29:32: error: 'foreach' was not declared in this scope foreach (int e in t) ^ suma_n.cpp:30:17: error: expected ';' before 'Console' Console.Write(e + " "); ^ suma_n.cpp:31:13: error: 'Console' was not declared in this scope Console.WriteLine(); ^ suma_n.cpp:32:21: error: 't' was not declared in this scope int n = t.Length; ^ suma_n.cpp:35:16: error: expected unqualified-id before '[' token int[] r = { 1, 3, 5, 2, 0, 9 }; ^ suma_n.cpp:36:22: error: expected primary-expression before 'int' foreach (int e in r) ^ suma_n.cpp:37:17: error: expected ';' before 'Console' Console.Write(e + " "); ^ suma_n.cpp:40:16: error: expected unqualified-id before '[' token int[,] a; ^ suma_n.cpp:42:17: error: 'Convert' was not declared in this scope n = Convert.ToInt32(Console.ReadLine()); ^ suma_n.cpp:47:13: error: 'a' was not declared in this scope a = new int[n, n]; ^ suma_n.cpp:47:28: warning: left operand of comma operator has no effect [-Wunused-value] a = new int[n, n]; ^ suma_n.cpp:48:13: error: 'Random' was not declared in this scope Random R = new Random(); ^ suma_n.cpp:48:20: error: expected ';' before 'R' Random R = new Random(); ^ suma_n.cpp:51:26: warning: left operand of comma operator has no effect [-Wunused-value] a[i, j] = R.Next(10); ^ suma_n.cpp:51:31: error: 'R' was not declared in this scope a[i, j] = R.Next(10); ^ suma_n.cpp:57:40: warning: left operand of comma operator has no effect [-Wunused-value] Console.Write(a[i, j] + " "); ^ suma_n.cpp:61:16: error: expected unqualified-id before '[' token int[,] b = new int[6, 4] ^ suma_n.cpp:75:9: error: expected '}' at end of input } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema suma_n 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ă.