#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 | #31275301 | Utilizator | |
Fișier | suma_n.cpp | Dimensiune | 2.44 KB |
Data încărcării | 08 Octombrie 2021, 12:32 | 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.IO; ^ suma_n.cpp:5:7: error: 'System' has not been declared suma_n.cpp:5:13: error: expected ';' before '.' token using System.IO; ^ 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.Linq; ^ suma_n.cpp:6:7: error: 'System' has not been declared suma_n.cpp:6:13: error: expected ';' before '.' token using System.Linq; ^ 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.Text; ^ suma_n.cpp:7:7: error: 'System' has not been declared suma_n.cpp:7:13: error: expected ';' before '.' token using System.Text; ^ suma_n.cpp:7:13: error: expected unqualified-id before '.' token suma_n.cpp:8:7: error: expected nested-name-specifier before 'System' using System.Threading.Tasks; ^ suma_n.cpp:8:7: error: 'System' has not been declared suma_n.cpp:8:13: error: expected ';' before '.' token using System.Threading.Tasks; ^ suma_n.cpp:8:13: error: expected unqualified-id before '.' token suma_n.cpp:20:26: error: 'string' has not been declared static void Main(string[] args) ^ suma_n.cpp:20: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 fisier_text_3::Program::Main(int*)': suma_n.cpp:22:17: error: expected unqualified-id before '[' token int [] pct; ^ suma_n.cpp:23:13: error: 'string' was not declared in this scope string [] nume; ^ suma_n.cpp:23:21: error: expected primary-expression before ']' token string [] nume; ^ suma_n.cpp:23:23: error: expected ';' before 'nume' string [] nume; ^ suma_n.cpp:25:20: error: expected ';' before 'linie' string linie, numePersoana; ^ suma_n.cpp:27:13: error: 'pct' was not declared in this scope pct = new int[201]; ^ suma_n.cpp:28:13: error: 'nume' was not declared in this scope nume = new string[201]; ^ suma_n.cpp:28:24: error: expected type-specifier before 'string' nume = new string[201]; ^ suma_n.cpp:28:24: error: expected ';' before 'string' suma_n.cpp:29:13: error: 'StreamReader' was not declared in this scope StreamReader fin = new StreamReader("concurs.txt"); ^ suma_n.cpp:29:26: error: expected ';' before 'fin' StreamReader fin = new StreamReader("concurs.txt"); ^ suma_n.cpp:30:13: error: 'StreamWriter' was not declared in this scope StreamWriter fout = new StreamWriter("a.txt"); ^ suma_n.cpp:30:26: error: expected ';' before 'fout' StreamWriter fout = new StreamWriter("a.txt"); ^ suma_n.cpp:31:26: error: expected ';' before 'f' StreamWriter f = new StreamWriter("b.txt"); ^ suma_n.cpp:32:21: error: 'linie' was not declared in this scope while ((linie = fin.ReadLine()) != null) ^ suma_n.cpp:32:29: error: 'fin' was not declared in this scope while ((linie = fin.ReadLine()) != null) ^ suma_n.cpp:32:48: error: 'null' was not declared in this scope while ((linie = fin.ReadLine()) != null) ^ suma_n.cpp:36:26: error: expected primary-expression before 'int' pct[n] = int.Parse(linie.Substring(k + 1).Trim()); ^ suma_n.cpp:36:26: error: expected ';' before 'int' suma_n.cpp:45:25: error: 'numePersoana' was not declared in this scope numePersoana = nume[i]; ^ suma_n.cpp:54:17: error: 'fout' was not declared in this scope fout.WriteLine(nume[i] + " " + pct[i]); ^ suma_n.cpp:61:25: error: 'numePersoana' was not declared in this scope numePersoana = nume[i]; ^ suma_n.cpp:70:17: error: 'f' was not declared in this scope f.WriteLine(nume[i] + " " + pct[i]); ^ suma_n.cpp:72:13: error: 'fin' was not declared in this scope fin.Close(); ^ suma_n.cpp:73:13: error: 'fout' was not declared in this scope fout.Close(); ^ suma_n.cpp:74:13: error: 'f' was not declared in this scope f.Close(); ^
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ă.