#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 | #53959484 | Utilizator | |
Fișier | matrice11.cpp | Dimensiune | 1.11 KB |
Data încărcării | 15 Noiembrie 2024, 22:03 | Scor / rezultat | Eroare de compilare |
matrice11.cpp:3:34: 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:10: error: 'n' was not declared in this scope cin>>n>>m; ^ matrice11.cpp:5:13: error: 'm' was not declared in this scope cin>>n>>m; ^ matrice11.cpp:8:18: error: 'a' was not declared in this scope cin>>a[i][j]; ^ matrice11.cpp: At global scope: matrice11.cpp:10:34: error: declaration of 'a' as multidimensional array must have bounds for all dimensions except the first int afisare(int n,int m, int a[][]) ^ matrice11.cpp: In function 'int afisare(...)': matrice11.cpp:12:25: error: 'n' was not declared in this scope for (int i = 0; i < n; i++) ^ matrice11.cpp:13:29: error: 'm' was not declared in this scope for (int j = 0; j < m; j++) ^ matrice11.cpp:14:19: error: 'a' was not declared in this scope cout<<a[i][j]<<" "; ^ matrice11.cpp:15:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ matrice11.cpp: At global scope: matrice11.cpp:16:34: 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:18:13: error: 'a' was not declared in this scope int min=a[0][0],imin=0; ^ matrice11.cpp:19:25: error: 'n' was not declared in this scope for (int i = 0; i < n; i++) ^ matrice11.cpp:20:29: error: 'm' was not declared in this scope for (int j = 0; j < m; j++) ^ matrice11.cpp:24:16: error: 'imin' was not declared in this scope imin=i; ^ matrice11.cpp:26:12: error: 'imin' was not declared in this scope return imin; ^ matrice11.cpp: At global scope: matrice11.cpp:28:34: 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:30:12: error: 'a' was not declared in this scope int max=a[0][0],imax=0; ^ matrice11.cpp:31:25: error: 'n' was not declared in this scope for (int i = 0; i < n; i++) ^ matrice11.cpp:32:29: error: 'm' was not declared in this scope for (int j = 0; j < m; j++) ^ matrice11.cpp:36:17: error: 'imax' was not declared in this scope imax=i; ^ matrice11.cpp:38:12: error: 'imax' was not declared in this scope return imax; ^ matrice11.cpp: At global scope: matrice11.cpp:40:42: error: declaration of 'a' as multidimensional array must have bounds for all dimensions except the first void interschimbare(int n,int m, int a[][]) ^ matrice11.cpp: In function 'void interschimbare(...)': matrice11.cpp:43:19: error: 'n' was not declared in this scope for(int i=0;i<n;i++) ^ matrice11.cpp:44:23: error: 'm' was not declared in this scope for(int j=0;j<m;j++) ^ matrice11.cpp:46:30: error: 'a' was not declared in this scope imin=lin_max(n,m,a); ^ matrice11.cpp:42:9: warning: unused variable 's' [-Wunused-variable] int s=0,imin=0,imax=0; ^ matrice11.cpp: In function 'int lin_min(...)': matrice11.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ matrice11.cpp: In function 'int lin_max(...)': matrice11.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
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ă.