#2825
Scrieți un program C/C++ care citește de la tastatură numere naturale din intervalul [3, 100], în această ordine: n și m, apoi elementele unui tablou bidimensional cu n linii și m coloane, iar la final un număr x.
Programul afișează pe ecran mesajul DA, dacă există cel puțin un element egal cu x aflat pe conturul tabloului (format din prima linie, ultima linie, prima coloană și ultima coloană), sau mesajul NU în caz contrar.
Subiect Bacalaureat 2016, sesiunea august-septembrie
| Problema | Chenar2 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64427407 | Utilizator | |
| Fișier | chenar2.cpp | Dimensiune | 647 B |
| Data încărcării | 06 Mai 2026, 12:42 | Scor/rezultat | Eroare de compilare |
chenar2.cpp: In function ‘int main()’: chenar2.cpp:8:6: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 8 | for(j=1;j<=m;j++) | ^~~ chenar2.cpp:9:23: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 9 | cin>>a[i][j]; ok==1; | ^~ chenar2.cpp:9:25: warning: statement has no effect [-Wunused-value] 9 | cin>>a[i][j]; ok==1; | ~~^~~ chenar2.cpp:13:12: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 13 | if(a[1][j]==x; | ^ chenar2.cpp:13:19: warning: statement has no effect [-Wunused-value] 13 | if(a[1][j]==x; | ~~~~~~~^~~ chenar2.cpp:14:16: error: expected ‘)’ before ‘;’ token 14 | ok=1; | ^ | ) chenar2.cpp:13:11: note: to match this ‘(’ 13 | if(a[1][j]==x; | ^ chenar2.cpp:14:14: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 14 | ok=1; | ~~^~ chenar2.cpp:13:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 13 | if(a[1][j]==x; | ^~ chenar2.cpp:15:12: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 15 | if(a[i][n]==x; | ^~ chenar2.cpp:15:15: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 15 | if(a[i][n]==x; | ^ chenar2.cpp:15:22: warning: statement has no effect [-Wunused-value] 15 | if(a[i][n]==x; | ~~~~~~~^~~ chenar2.cpp:16:19: error: expected ‘)’ before ‘;’ token 16 | ok=1; | ^ | ) chenar2.cpp:15:14: note: to match this ‘(’ 15 | if(a[i][n]==x; | ^ chenar2.cpp:16:17: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 16 | ok=1; | ~~^~ chenar2.cpp:21:12: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 21 | if(a[i][1]==x; | ^ chenar2.cpp:21:19: warning: statement has no effect [-Wunused-value] 21 | if(a[i][1]==x; | ~~~~~~~^~~ chenar2.cpp:22:16: error: expected ‘)’ before ‘;’ token 22 | ok=1; | ^ | ) chenar2.cpp:21:11: note: to match this ‘(’ 21 | if(a[i][1]==x; | ^ chenar2.cpp:22:14: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 22 | ok=1; | ~~^~ chenar2.cpp:21:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 21 | if(a[i][1]==x; | ^~ chenar2.cpp:23:12: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 23 | if(a[i][m]==x; | ^~ chenar2.cpp:23:15: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 23 | if(a[i][m]==x; | ^ chenar2.cpp:23:22: warning: statement has no effect [-Wunused-value] 23 | if(a[i][m]==x; | ~~~~~~~^~~ chenar2.cpp:24:19: error: expected ‘)’ before ‘;’ token 24 | ok=1; | ^ | ) chenar2.cpp:23:14: note: to match this ‘(’ 23 | if(a[i][m]==x; | ^ chenar2.cpp:24:17: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 24 | ok=1; | ~~^~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Chenar2 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ă.