end day 3
This commit is contained in:
parent
53d6e7ddef
commit
0f51dceaa1
|
@ -2,11 +2,8 @@ CC = gcc
|
|||
|
||||
all:
|
||||
$(CC) b2hd.c -o b2hd
|
||||
$(CC) fileGestion.c getArray.c -o getArray
|
||||
#$(CC) power.c -o power
|
||||
$(CC) fileGestion.c getArray.c power.c -lm -o power
|
||||
#getArray.c fileGestion.c power.c main.c -o main
|
||||
|
||||
./b2hd < ../02400031.TXT > rawData.txt
|
||||
./getArray
|
||||
clean:
|
||||
rm decValues.txt newFile.txt
|
||||
./power
|
BIN
Code-C/getArray
BIN
Code-C/getArray
Binary file not shown.
|
@ -1,5 +1,4 @@
|
|||
#include "getArray.h"
|
||||
#include "initialParameters.h"
|
||||
#include "fileGestion.h"
|
||||
|
||||
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;
|
||||
for(i = 0 ; i < N ; i++)
|
||||
for(j = 0 ; j < M ; j++)
|
||||
|
@ -49,16 +48,12 @@ void freeArray(int** p, int N) {
|
|||
free(p);
|
||||
}
|
||||
|
||||
int **getRawDataArray(){
|
||||
int **getRawDataArray(int N , int M){
|
||||
int **p;
|
||||
p = get(nRow, nCol);
|
||||
fillRawData(p ,nRow, nCol);
|
||||
//print(p, nRow, nCol);
|
||||
clearRawData(nRow);
|
||||
p = get(N, M);
|
||||
fillRawData(p ,N, M);
|
||||
//printArray(p, nRow, nCol);
|
||||
clearRawData(N);
|
||||
//freeArray(p ,nRow);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void main(int argc , char** argv){
|
||||
getRawDataArray();
|
||||
return p;
|
||||
}
|
|
@ -3,4 +3,5 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int **getArray();
|
||||
int **getRawDataArray();
|
||||
void printArray(int** p, int N, int M);
|
BIN
Code-C/power
Executable file
BIN
Code-C/power
Executable file
Binary file not shown.
|
@ -1,23 +1,29 @@
|
|||
#include "power.h"
|
||||
#include "getArray.h"
|
||||
#include "initialParameters.h"
|
||||
|
||||
double power(int **p){
|
||||
double periode = 1 /freqEch;
|
||||
double periode = (1/freqEch);
|
||||
printf("periode : %d\n",periode);
|
||||
double power[8];
|
||||
for(int i = 0; i < 8; i++){
|
||||
for(int i = 1; i < nCol; i++){
|
||||
int j = 0;
|
||||
double res = 0;
|
||||
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;
|
||||
printf("aire [%d,%d] : %d\n",j,i,aire);
|
||||
res += aire;
|
||||
j++;
|
||||
}
|
||||
printf("résultat : %d\n",res);
|
||||
power[i] = res;
|
||||
}
|
||||
return *power;
|
||||
}
|
||||
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);
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
#include "math.h"
|
||||
#include "initialParameters.h"
|
||||
#include <math.h>
|
||||
|
||||
double power(int tab[nRow][8]);
|
||||
double power(int **p);
|
1600022
Code-C/rawData.txt
1600022
Code-C/rawData.txt
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue