end day 3

This commit is contained in:
quentin.perret 2022-06-01 18:02:32 +02:00
parent 53d6e7ddef
commit 0f51dceaa1
8 changed files with 800034 additions and 800036 deletions

View file

@ -2,11 +2,8 @@ CC = gcc
all: all:
$(CC) b2hd.c -o b2hd $(CC) b2hd.c -o b2hd
$(CC) fileGestion.c getArray.c -o getArray $(CC) fileGestion.c getArray.c power.c -lm -o power
#$(CC) power.c -o power
#getArray.c fileGestion.c power.c main.c -o main #getArray.c fileGestion.c power.c main.c -o main
./b2hd < ../02400031.TXT > rawData.txt ./b2hd < ../02400031.TXT > rawData.txt
./getArray ./power
clean:
rm decValues.txt newFile.txt

Binary file not shown.

View file

@ -1,5 +1,4 @@
#include "getArray.h" #include "getArray.h"
#include "initialParameters.h"
#include "fileGestion.h" #include "fileGestion.h"
int **get(int N, int M) /* Allocate the array */ int **get(int N, int M) /* Allocate the array */
@ -35,7 +34,7 @@ void fillRawData(int** p, int N, int M) {
} }
} }
void print(int** p, int N, int M) { void printArray(int** p, int N, int M) {
int i, j; int i, j;
for(i = 0 ; i < N ; i++) for(i = 0 ; i < N ; i++)
for(j = 0 ; j < M ; j++) for(j = 0 ; j < M ; j++)
@ -49,16 +48,12 @@ void freeArray(int** p, int N) {
free(p); free(p);
} }
int **getRawDataArray(){ int **getRawDataArray(int N , int M){
int **p; int **p;
p = get(nRow, nCol); p = get(N, M);
fillRawData(p ,nRow, nCol); fillRawData(p ,N, M);
//print(p, nRow, nCol); //printArray(p, nRow, nCol);
clearRawData(nRow); clearRawData(N);
//freeArray(p ,nRow); //freeArray(p ,nRow);
return 0; return p;
}
void main(int argc , char** argv){
getRawDataArray();
} }

View file

@ -3,4 +3,5 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
int **getArray(); int **getRawDataArray();
void printArray(int** p, int N, int M);

BIN
Code-C/power Executable file

Binary file not shown.

View file

@ -1,23 +1,29 @@
#include "power.h" #include "power.h"
#include "getArray.h" #include "getArray.h"
#include "initialParameters.h"
double power(int **p){ double power(int **p){
double periode = 1 /freqEch; double periode = (1/freqEch);
printf("periode : %d\n",periode);
double power[8]; double power[8];
for(int i = 0; i < 8; i++){ for(int i = 1; i < nCol; i++){
int j = 0; int j = 0;
double res = 0; double res = 0;
while(1){ while(1){
if(!p[j+1][i]) break; if(!(p[j+1][i] == NULL)) break;
double aire = ( pow(p[j][i],2) + pow(p[j+1][i],2) ) / 2 * periode; double aire = ( pow(p[j][i],2) + pow(p[j+1][i],2) ) / 2 * periode;
printf("aire [%d,%d] : %d\n",j,i,aire);
res += aire; res += aire;
j++; j++;
} }
printf("résultat : %d\n",res);
power[i] = res; power[i] = res;
} }
return *power; return *power;
} }
int main(int argc , char** argv){ int main(int argc , char** argv){
double pw = power(getArray()); int **p = getRawDataArray(nRow, nCol);
//printArray(p,nRow,nCol);
double pw = power(p);
printf("%d" , pw); printf("%d" , pw);
} }

View file

@ -1,4 +1,3 @@
#include "math.h" #include <math.h>
#include "initialParameters.h"
double power(int tab[nRow][8]); double power(int **p);

File diff suppressed because it is too large Load diff