Results 1 to 2 of 2
Hybrid View
-
3rd January 2014 16:17 #1Registered User
Join Date: Aug:2012
Location:
Posts: 297
, .
: (nxm)
.
( ) .
, .Code:#include <iostream> #include <iomanip> #include <string> using namespace std; int main() { int n,m,k; // nxm matrica , k prez kolko elementa da se obhojda cout << "Enter n , m ,k : "; cin >> n >> m >> k ; cout << &m << endl << &n; int * pointer = new int[n][m]; cout << " Enter matrix A (nxm) : " << endl; for(int i = 0 ; i <= n-1 ; i++) for(int j = 0; j <= m-1 ; j++) cin >> pointer[i][j]; int * pointertmp; // , int j = 0; while(j <= k ) { j++; pointertmp = pointer[0] + j; // while(pointertmp <= pointer[n-1][m-1]) { counter ++; cout << *pointertmp; pointertmp+=k; } } cin.sync(); cin.get(); return 0; }
, , , , , ., .
, .Last edited by DuMBo0o; 3rd January 2014 at 16:50.
-
4th January 2014 18:12 #2
.
- "" /, /, I (N*M) , -1 , I 0 -1.
, , delete[], .
...
Visual C++?Code:#include <iostream> #include <stdlib.h> using namespace std; int main(int argc, char *argv[]) { int N = 4; int M = 4; int a [N][M]; for(int i = 0; i < N; i++) { for(int j = 0; j < M; j++) { a[i][j] = i*N + j; } } for(int i = 0; i < N; i++) { for(int j = 0; j < M; j++) { cout << "a[" << i << "," << j << "]=" << a[i][j] << " "; a[i][j] = i*N + j; } cout << endl; } return 0; }
g++ , "" ISO C++.Last edited by hateras; 4th January 2014 at 19:41.
ASRock B550M Pro 4; Ryzen R5 3600; 2x16 GiB G.SKILL Aegis 3200; 1TB Samsung QVO 960 + 3TB Seagate IronWolf; Zalman Z1




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in