22 Novembre
This commit is contained in:
parent
62d68f4ceb
commit
1ed4aa94d6
47
DEV1.1/TP12:Structures/complexes.c
Normal file
47
DEV1.1/TP12:Structures/complexes.c
Normal file
@ -0,0 +1,47 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct complexe{
|
||||
double reel;
|
||||
double imag;
|
||||
};
|
||||
|
||||
typedef struct complexe complexe;
|
||||
|
||||
void afficheComplexe(double x , double y){
|
||||
printf("La notation algebrique de ce nombre complexe est : %lf+%lfi\n",x,y);
|
||||
}
|
||||
|
||||
double calcModule(complexe C){
|
||||
double module;
|
||||
module = pow (C.reel,2)+ pow (C.imag,2);
|
||||
module = pow (module,0.5);
|
||||
return module;
|
||||
}
|
||||
|
||||
complexe calcConjugue(complexe C){
|
||||
complexe res;
|
||||
res.reel=C.reel;
|
||||
res.imag=-C.imag;
|
||||
return res;
|
||||
}
|
||||
|
||||
complexe calcInverse(complexe C){
|
||||
complexe res;
|
||||
res.reel=C.reel/pow(calcModule(C),2);
|
||||
res.imag=C.imag/pow(calcModule(C),2);
|
||||
return res;
|
||||
}
|
||||
|
||||
int main() {
|
||||
complexe C = {6,10};
|
||||
afficheComplexe(C.reel , C.imag);
|
||||
double moduleDeC=(calcModule(C));
|
||||
printf("Le module de ce complexe est : %lf\n",moduleDeC);
|
||||
complexe conjugueDeC = calcConjugue(C);
|
||||
afficheComplexe(conjugueDeC.reel , conjugueDeC.imag);
|
||||
complexe inverseDeC = calcInverse(C);
|
||||
afficheComplexe(inverseDeC.reel , inverseDeC.imag);
|
||||
return 0;
|
||||
}
|
@ -3,7 +3,12 @@
|
||||
#include <grp.h>
|
||||
|
||||
int main() {
|
||||
struct group student = getgrnam(etc/group/students22);
|
||||
printf("%s",student.gr_mem);
|
||||
int i = 0;
|
||||
struct group etu;
|
||||
etu = *getgrnam("senart22");
|
||||
while (etu.gr_mem[i]!=NULL){
|
||||
i++;
|
||||
printf("%s",etu.gr_mem[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user