Ajout des travaux effectuer
This commit is contained in:
BIN
23DEV1.1/TPS1/TP2/19-Structures/Complexes
Executable file
BIN
23DEV1.1/TPS1/TP2/19-Structures/Complexes
Executable file
Binary file not shown.
54
23DEV1.1/TPS1/TP2/19-Structures/Complexes.c
Normal file
54
23DEV1.1/TPS1/TP2/19-Structures/Complexes.c
Normal file
@@ -0,0 +1,54 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
struct nbrcomplex{
|
||||
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
typedef struct nbrcomplex complex;
|
||||
|
||||
void afficher(complex z){
|
||||
printf("%f + %fi\n", z.x, z.y);
|
||||
}
|
||||
|
||||
float module(complex z){
|
||||
float res = sqrt(pow(z.x, 2)+pow(z.y, 2));
|
||||
float resrac = pow(res, 0.5);
|
||||
return resrac;
|
||||
}
|
||||
|
||||
complex inverse(complex z){
|
||||
complex a;
|
||||
a.x = z.x/pow(module(z), 2);
|
||||
a.y = z.y/pow(module(z), 2);
|
||||
return a;
|
||||
}
|
||||
|
||||
complex conjugue(complex z){
|
||||
complex b;
|
||||
b.x = z.x;
|
||||
b.y = -z.y;
|
||||
return b;
|
||||
}
|
||||
|
||||
int main(int argc, char const* argv[]){
|
||||
complex z = {3,8};
|
||||
complex a, b, c;
|
||||
|
||||
afficher(z);
|
||||
|
||||
a = z;
|
||||
module(a);
|
||||
printf("|z| = %f\n", a);
|
||||
|
||||
b = conjugue(z);
|
||||
afficher(b);
|
||||
printf("conjugue = %f\n", b);
|
||||
|
||||
c = inverse(z);
|
||||
afficher(c);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
16
23DEV1.1/TPS1/TP2/19-Structures/Numeros.c
Normal file
16
23DEV1.1/TPS1/TP2/19-Structures/Numeros.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pwd.h>
|
||||
|
||||
struct id_s {
|
||||
int UID;
|
||||
char name;
|
||||
};
|
||||
|
||||
typedef struct id_s id;
|
||||
|
||||
int main(int argc, char const* argv[]){
|
||||
int x = getpwuid();
|
||||
char y = getpwnam();
|
||||
id r = {, };
|
||||
}
|
||||
17
23DEV1.1/TPS1/TP2/19-Structures/Tailles.c
Normal file
17
23DEV1.1/TPS1/TP2/19-Structures/Tailles.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct taille{
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
/*char a;
|
||||
char b;
|
||||
char c;*/
|
||||
};
|
||||
|
||||
typedef struct taille e;
|
||||
|
||||
int main(int argc, char const* argv[]){
|
||||
printf("%d\n",sizeof(e));
|
||||
}
|
||||
BIN
23DEV1.1/TPS1/TP2/19-Structures/a.out
Executable file
BIN
23DEV1.1/TPS1/TP2/19-Structures/a.out
Executable file
Binary file not shown.
13
23DEV1.1/TPS1/TP2/19-Structures/date.c
Normal file
13
23DEV1.1/TPS1/TP2/19-Structures/date.c
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
time_t times = time(NULL);
|
||||
struct tm * timeI = localtime(×);
|
||||
printf("Heure locale : %02d:%02d:%02d", timeI->tm_hour, timeI->tm_min, timeI->tm_sec);
|
||||
printf("\n");
|
||||
printf("Date locale : %04d/%02d/%02d",timeI->tm_year+1900,timeI->tm_mon,timeI->tm_mday);
|
||||
printf("\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user