-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunarch.cpp
41 lines (33 loc) · 853 Bytes
/
unarch.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// MODIF
#include <iostream>
#include "Matrix.hpp"
void unarch(int*** matrix, int N, int N2, int** archArr, int* archLeng, int** zeroIndexArr, int* zeloLeng)
{
bool b = false;
int counter = 0;
(*matrix) = new int *[N];
for(int i = 0; i < N; i++)
{
(*matrix)[i] = new int [N2];
for(int j = 0; j < N2; j++)
{
int curentN = (i*N) + j;
for(int k = 0; k < *zeloLeng; k++)
{
if((*zeroIndexArr)[k] == curentN)
{
(*matrix)[i][j] = 0;
b = true;
break;
}
}
if(!b)
{
(*matrix)[i][j] = (*archArr)[counter++];
}
b = false;
}
}
delete [] *zeroIndexArr;
delete [] *archArr;
}