#214
Scrieţi un program care citeşte de la tastatură un număr natural nenul n cu cel mult 9 cifre şi construieşte un tablou bidimensional pătratic cu dimensiunea egală cu numărul de cifre ale lui n, completată cu cifrele lui n.
Variante Bacalaureat 2009
| Problema | GenMat5 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64808395 | Utilizator | |
| Fișier | genmat5.cpp | Dimensiune | 402 B |
| Data încărcării | 02 Iunie 2026, 17:40 | Scor/rezultat | Eroare de compilare |
genmat5.cpp: In function ‘int main()’: genmat5.cpp:6:11: error: ‘cn’ was not declared in this scope; did you mean ‘n’? 6 | { cin>>n; cn=n | ^~ | n genmat5.cpp:11:18: warning: left operand of comma operator has no effect [-Wunused-value] 11 | for(int i=1;i<=cnt,i++){ | ~^~~~~ genmat5.cpp:11:27: error: expected ‘;’ before ‘)’ token 11 | for(int i=1;i<=cnt,i++){ | ^ | ; genmat5.cpp:13:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 13 | for(int j=1;j<=cn;j++) | ^~~ genmat5.cpp:15:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 15 | cn/=10;} | ^~ genmat5.cpp:16:25: warning: left operand of comma operator has no effect [-Wunused-value] 16 | for(int i=1;i<=cnt,i++) { | ~^~~~~ genmat5.cpp:16:34: error: expected ‘;’ before ‘)’ token 16 | for(int i=1;i<=cnt,i++) { | ^ | ; genmat5.cpp:17:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 17 | for(int j=1;j<=cn;j++) | ^~~ genmat5.cpp:19:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 19 | cout<<'\n';} | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema GenMat5 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ă.