#2822
Scrieți un program care citește de la tastatură un număr natural, n (n∈[2,102]), și construiește în memorie un tablou bidimensional, cu n linii și n coloane, astfel:
[1,n];n;Subiect Bacalaureat 2016, sesiunea iunie-iulie
| Problema | GenMat25 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64527621 | Utilizator | |
| Fișier | genmat25.cpp | Dimensiune | 345 B |
| Data încărcării | 12 Mai 2026, 16:40 | Scor/rezultat | Eroare de compilare |
genmat25.cpp: In function ‘int main()’: genmat25.cpp:16:29: error: expected ‘;’ before ‘}’ token 16 | for(i=0;i<n;i++){t[i][0]=x+1} | ^ | ; genmat25.cpp:14:11: warning: unused variable ‘j’ [-Wunused-variable] 14 | int i,j,x=0; | ^ genmat25.cpp: At global scope: genmat25.cpp:21:1: error: expected unqualified-id before ‘for’ 21 | for(i=n-2;i>=0;i--) | ^~~ genmat25.cpp:21:11: error: ‘i’ does not name a type 21 | for(i=n-2;i>=0;i--) | ^ genmat25.cpp:21:16: error: ‘i’ does not name a type 21 | for(i=n-2;i>=0;i--) | ^ genmat25.cpp:22:13: error: ‘j’ does not name a type 22 | for(j=1;j<n;j++) | ^ genmat25.cpp:22:17: error: ‘j’ does not name a type 22 | for(j=1;j<n;j++) | ^ genmat25.cpp:24:1: error: expected unqualified-id before ‘for’ 24 | for(i=0;i<n;i++){for(j=0;j<n;j++)cout<<t[i][j]<<" ";cout<<'\n';} | ^~~ genmat25.cpp:24:9: error: ‘i’ does not name a type 24 | for(i=0;i<n;i++){for(j=0;j<n;j++)cout<<t[i][j]<<" ";cout<<'\n';} | ^ genmat25.cpp:24:13: error: ‘i’ does not name a type 24 | for(i=0;i<n;i++){for(j=0;j<n;j++)cout<<t[i][j]<<" ";cout<<'\n';} | ^ genmat25.cpp:27:1: error: expected declaration before ‘}’ token 27 | } | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema GenMat25 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ă.