#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 |
![]() |
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #31080114 | Utilizator | |
Fișier | suma_n.cpp | Dimensiune | 5.99 KB |
Data încărcării | 01 Octombrie 2021, 13:00 | Scor / rezultat | Eroare de compilare |
suma_n.cpp:75:17: error: stray '@' in program s = @"El a zis: 'Nihil sine Deo'."; ^ suma_n.cpp:76:17: error: stray '@' in program t = @"c:\teste\12A\csharp\a.txt"; ^ suma_n.cpp:79:17: error: stray '@' in program t = @"Lista elevilor: ^ suma_n.cpp:79:18: warning: missing terminating " character [enabled by default] t = @"Lista elevilor: ^ suma_n.cpp:79:13: error: missing terminating " character t = @"Lista elevilor: ^ suma_n.cpp:83:8: warning: missing terminating " character [enabled by default] Barutzu"; ^ suma_n.cpp:83:1: error: missing terminating " character Barutzu"; ^ suma_n.cpp:86:17: error: stray '@' in program t = @"Ana 'are' \ mere ^ suma_n.cpp:86:18: warning: missing terminating " character [enabled by default] t = @"Ana 'are' \ mere ^ suma_n.cpp:86:13: error: missing terminating " character t = @"Ana 'are' \ mere ^ suma_n.cpp:87:4: warning: multi-character character constant [-Wmultichar] si 'pere'"; ^ suma_n.cpp:87:10: warning: missing terminating " character [enabled by default] si 'pere'"; ^ suma_n.cpp:87:1: error: missing terminating " character si 'pere'"; ^ suma_n.cpp:122:31: error: stray '@' in program Console.WriteLine(@"Cuvinte care incep cu 'sta':"); ^ suma_n.cpp:126:31: error: stray '@' in program Console.WriteLine(@"Cuvinte care se termina cu 'al':"); ^ 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:203:5: error: expected ';' after class definition } ^ suma_n.cpp: In static member function 'static void p07_string::Program::Main(int*)': suma_n.cpp:48:13: error: 'string' was not declared in this scope string s = "1234abcd"; ^ suma_n.cpp:48:20: error: expected ';' before 's' string s = "1234abcd"; ^ suma_n.cpp:49:13: error: 'Console' was not declared in this scope Console.WriteLine("Am " + "21 de ani"); ^ suma_n.cpp:49:39: error: invalid operands of types 'const char [4]' and 'const char [10]' to binary 'operator+' Console.WriteLine("Am " + "21 de ani"); ^ suma_n.cpp:50:13: error: 's' was not declared in this scope s += "90" + 33; ^ suma_n.cpp:54:20: error: request for member 'ToString' in 'x', which is of non-class type 'int' s += x.ToString();// converteste explicit ^ suma_n.cpp:63:20: error: expected ';' before 't' string t = "abcd"; ^ suma_n.cpp:65:22: error: 't' was not declared in this scope if (s != t) Console.WriteLine("Nu-s egale"); ^ suma_n.cpp:68:13: error: 't' was not declared in this scope t = s; ^ suma_n.cpp:76:18: warning: unknown escape sequence: '\c' [enabled by default] t = @"c:\teste\12A\csharp\a.txt"; ^ suma_n.cpp:80:1: error: 'Popescu' was not declared in this scope Popescu ^ suma_n.cpp:81:1: error: expected ';' before 'Ionescu' Ionescu ^ suma_n.cpp:87:1: error: 'si' was not declared in this scope si 'pere'"; ^ suma_n.cpp:87:4: error: expected ';' before '\x70657265' si 'pere'"; ^ suma_n.cpp:90:20: error: expected ';' before 'w' string w = "ana are mere"; ^ suma_n.cpp:91:21: error: 'w' was not declared in this scope int n = w.Length; ^ suma_n.cpp:119:20: error: expected primary-expression before ']' token string[] q = {"start", "stop", "final", ^ suma_n.cpp:119:22: error: expected ';' before 'q' string[] q = {"start", "stop", "final", ^ suma_n.cpp:123:29: error: expected ')' before 'v' foreach (string v in q) ^ suma_n.cpp:123:35: error: 'foreach' was not declared in this scope foreach (string v in q) ^ suma_n.cpp:124:17: error: expected ';' before 'if' if (v.StartsWith("sta")) ^ suma_n.cpp:127:28: error: expected ')' before 'v' foreach(string v in q) ^ suma_n.cpp:128:17: error: expected ';' before 'if' if (v.EndsWith("al")) ^ suma_n.cpp:146:17: error: expected unqualified-id before '[' token char[] lit = { 'm', 'p', 'r' }; ^ suma_n.cpp:148:44: error: 'lit' was not declared in this scope Console.WriteLine(s.IndexOfAny(lit)); ^ suma_n.cpp:150:22: error: expected primary-expression before ']' token new char[]{'e','p'})); ^ suma_n.cpp:150:31: error: too many initializers for 'char [1]' new char[]{'e','p'})); ^
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ă.