#4252
Matrice11
Scrieți un program care citește de la tastatură două numere naturale din intervalul [2,50]
, n
și m
, și elementele unei matrici cu n
linii și m
coloane, numere naturale distincte din intervalul [0,10
4
]
.
Programul interschimbă elementele de pe linia pe care se află valoarea minimă cu elementele cu linia pe care se află valoarea maximă din matrice, apoi afișează pe ecran matricea modificată, câte o linie a matricii pe câte o linie a ecranului, elementele fiecărei linii fiind separate prin câte un spațiu.
Problema | Matrice11 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53122296 | Utilizator | |
Fișier | matrice11.cpp | Dimensiune | 1016 B |
Data încărcării | 18 Octombrie 2024, 09:50 | Scor / rezultat | Eroare de compilare |
matrice11.cpp:4:37: error: declaration of 'a' as multidimensional array must have bounds for all dimensions except the first void citire(int &n, int &m, int a[][]) ^ matrice11.cpp: In function 'void citire(...)': matrice11.cpp:5:8: error: 'n' was not declared in this scope { cin>>n>>m; ^ matrice11.cpp:5:11: error: 'm' was not declared in this scope { cin>>n>>m; ^ matrice11.cpp:8:16: error: 'a' was not declared in this scope cin>>a[i][j]; ^ matrice11.cpp: At global scope: matrice11.cpp:11:36: error: declaration of 'a' as multidimensional array must have bounds for all dimensions except the first void afisare(int n, int m, int a[][]) ^ matrice11.cpp: In function 'void afisare(...)': matrice11.cpp:12:18: error: 'n' was not declared in this scope { for(int i=1;i<=n;i++) ^ matrice11.cpp:13:22: error: 'm' was not declared in this scope {for(int j=1;j<=m;j++) ^ matrice11.cpp:14:17: error: 'a' was not declared in this scope cout<<a[i][j]; ^ matrice11.cpp: At global scope: matrice11.cpp:19:35: error: declaration of 'a' as multidimensional array must have bounds for all dimensions except the first int lin_max(int n, int m, int a[][]) ^ matrice11.cpp: In function 'int lin_max(...)': matrice11.cpp:20:11: error: 'a' was not declared in this scope { int max=a[1][1]; int l1=0; ^ matrice11.cpp:21:18: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ matrice11.cpp:22:22: error: 'm' was not declared in this scope for(int j=1;j<=m;j++) ^ matrice11.cpp: At global scope: matrice11.cpp:30:35: error: declaration of 'a' as multidimensional array must have bounds for all dimensions except the first int lin_min(int n, int m, int a[][]) ^ matrice11.cpp: In function 'int lin_min(...)': matrice11.cpp:31:11: error: 'a' was not declared in this scope { int min=a[1][1]; int l2=0; ^ matrice11.cpp:32:18: error: 'n' was not declared in this scope for(int i=1;i<=n;i++) ^ matrice11.cpp:33:22: error: 'm' was not declared in this scope for(int j=1;j<=m;j++) ^ matrice11.cpp: At global scope: matrice11.cpp:41:45: error: declaration of 'a' as multidimensional array must have bounds for all dimensions except the first void interschimbare(int l1, int l2, int a[][]) ^ matrice11.cpp: In function 'void interschimbare(...)': matrice11.cpp:42:3: error: 'a' was not declared in this scope { a[l1][j]=a[l2][j]; ^ matrice11.cpp:42:5: error: 'l1' was not declared in this scope { a[l1][j]=a[l2][j]; ^ matrice11.cpp:42:9: error: 'j' was not declared in this scope { a[l1][j]=a[l2][j]; ^ matrice11.cpp:42:14: error: 'l2' was not declared in this scope { a[l1][j]=a[l2][j]; ^ matrice11.cpp: In function 'int main()': matrice11.cpp:46:23: warning: unused variable 'i' [-Wunused-variable] { int n,m,a[500][500],i,j; ^ matrice11.cpp:46:25: warning: unused variable 'j' [-Wunused-variable] { int n,m,a[500][500],i,j; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Matrice11 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ă.