diff --git a/DEV1.1/TP12:Structures/complexes.c b/DEV1.1/TP12:Structures/complexes.c new file mode 100644 index 0000000..e9976b3 --- /dev/null +++ b/DEV1.1/TP12:Structures/complexes.c @@ -0,0 +1,47 @@ +#include +#include +#include + +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; +} \ No newline at end of file diff --git a/DEV1.1/TP12:Structures/groupe.c b/DEV1.1/TP12:Structures/groupe.c index 666f33e..54a42fb 100644 --- a/DEV1.1/TP12:Structures/groupe.c +++ b/DEV1.1/TP12:Structures/groupe.c @@ -3,7 +3,12 @@ #include 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; } \ No newline at end of file