Début TP13
This commit is contained in:
BIN
DEV1.1/TP12/triangle
Executable file
BIN
DEV1.1/TP12/triangle
Executable file
Binary file not shown.
22
DEV1.1/TP12/triangle.c
Normal file
22
DEV1.1/TP12/triangle.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
int ligne,colonne;
|
||||
int tab[30][30]={{1}};
|
||||
for(ligne=1;ligne<30;ligne++){
|
||||
for(colonne=0;colonne<30;colonne++){
|
||||
if (colonne==0)
|
||||
tab[ligne][colonne]=1;
|
||||
tab[ligne][colonne]=(tab[ligne-1][colonne-1]+tab[ligne-1][colonne]);
|
||||
}
|
||||
}
|
||||
for(ligne=0;ligne<30;ligne++){
|
||||
for(colonne=0;colonne<30;colonne++){
|
||||
if (tab[ligne][colonne]!=0)
|
||||
printf("%3d ",tab[ligne][colonne]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
BIN
DEV1.1/TP13/alphabet
Executable file
BIN
DEV1.1/TP13/alphabet
Executable file
Binary file not shown.
21
DEV1.1/TP13/alphabet.c
Normal file
21
DEV1.1/TP13/alphabet.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
int main(void) {
|
||||
char min, maj;
|
||||
char *p = NULL;
|
||||
|
||||
for(min = 'a', maj = 'A'; maj <= 'Z'; min++, maj++) {
|
||||
p = (p == &min) ? &maj : &min;
|
||||
putchar(*p);
|
||||
}
|
||||
putchar('\n');
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*Cela va écrire l'alphabet en minuscule*/
|
||||
|
||||
/*Correction: Cela va écrire l'alphabet en alternant entre des minuscules et
|
||||
des majuscules avec a en minuscule*/
|
||||
BIN
DEV1.1/TP13/cartographie
Executable file
BIN
DEV1.1/TP13/cartographie
Executable file
Binary file not shown.
21
DEV1.1/TP13/cartographie.c
Normal file
21
DEV1.1/TP13/cartographie.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
int val1;
|
||||
double val2;
|
||||
long double val3;
|
||||
char val4;
|
||||
short int val5;
|
||||
int val6;
|
||||
long long unsigned int val7;
|
||||
int* ptr1=&val1;
|
||||
double* ptr2=&val2;
|
||||
long double* ptr3=&val3;
|
||||
char* ptr4=&val4;
|
||||
short int* ptr5=&val5;
|
||||
int* ptr6=&val6;
|
||||
long long unsigned int* ptr7=&val7;
|
||||
printf("%p %p %p %p %p %p %p \n",ptr1,ptr2,ptr3,ptr4,ptr5,ptr6,ptr7);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
BIN
DEV1.1/TP13/conversion
Executable file
BIN
DEV1.1/TP13/conversion
Executable file
Binary file not shown.
9
DEV1.1/TP13/conversion.c
Normal file
9
DEV1.1/TP13/conversion.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
long long int n = 4614256656552045848LL;
|
||||
double* p = (double*) &n;
|
||||
printf("π = %f\n", *p);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
BIN
DEV1.1/TP13/conversion2
Executable file
BIN
DEV1.1/TP13/conversion2
Executable file
Binary file not shown.
9
DEV1.1/TP13/conversion2.c
Normal file
9
DEV1.1/TP13/conversion2.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
long long int x = 4614256656552045848LL,n=x/2;
|
||||
double* p = (double*) &n;
|
||||
printf("π = %f\n", *p);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
BIN
DEV1.1/TP13/mort-vivant
Executable file
BIN
DEV1.1/TP13/mort-vivant
Executable file
Binary file not shown.
21
DEV1.1/TP13/mort-vivant.c
Normal file
21
DEV1.1/TP13/mort-vivant.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
int main(void) {
|
||||
int* p;
|
||||
|
||||
if(time(NULL)%2) {
|
||||
int x = 59;
|
||||
p = &x;
|
||||
} else {
|
||||
int y = 31;
|
||||
p = &y;
|
||||
}
|
||||
printf("x=%d\n", x);
|
||||
printf("y=%d\n", y);
|
||||
printf("%d\n", *p);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/*Cela va afficher 59 , elle est stockée dans x*/
|
||||
Reference in New Issue
Block a user