23 lines
522 B
C
23 lines
522 B
C
#include "power.h"
|
|
#include "getArray.h"
|
|
|
|
double power(int **p){
|
|
double periode = 1 /freqEch;
|
|
double power[8];
|
|
for(int i = 0; i < 8; i++){
|
|
int j = 0;
|
|
double res = 0;
|
|
while(1){
|
|
if(!p[j+1][i]) break;
|
|
double aire = ( pow(p[j][i],2) + pow(p[j+1][i],2) ) / 2 * periode;
|
|
res += aire;
|
|
j++;
|
|
}
|
|
power[i] = res;
|
|
}
|
|
return *power;
|
|
}
|
|
int main(int argc , char** argv){
|
|
double pw = power(getArray());
|
|
printf("%d" , pw);
|
|
} |