Ajout des travaux effectuer
This commit is contained in:
20
23DEV1.1/TPS1/TP2/18-AllocationDynamique/Palindromes.c
Normal file
20
23DEV1.1/TPS1/TP2/18-AllocationDynamique/Palindromes.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int mot;
|
||||
int i;
|
||||
if (argc > 2) {
|
||||
for(i=0;i<;i++){
|
||||
|
||||
if(inverse(argv[])==argv[]){
|
||||
printf("%s est un palindrome");
|
||||
}else{
|
||||
printf("%s n'est pas un palindrome");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
puts("aucun argument !");
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
35
23DEV1.1/TPS1/TP2/18-AllocationDynamique/Précognition.c
Normal file
35
23DEV1.1/TPS1/TP2/18-AllocationDynamique/Précognition.c
Normal file
@@ -0,0 +1,35 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int num = 0;
|
||||
int i, j;
|
||||
double comp;
|
||||
double in;
|
||||
int doublon;
|
||||
char revoir;
|
||||
double* tab = (double*) malloc(sizeof(double));
|
||||
while(revoir != 'q' || revoir != 'Q'){
|
||||
printf("case %d : ", num);
|
||||
scanf("%lf", tab+i);
|
||||
num++;
|
||||
printf("quitter ? ");
|
||||
scanf("%c", &revoir);
|
||||
printf("\n");
|
||||
}
|
||||
for(i=0;i<num;i++){
|
||||
doublon = 0;
|
||||
comp=tab[i];
|
||||
for(j=0;j<num;j++){
|
||||
if((*(tab+i) == *(tab+j) && (tab+i) != (tab+j))){
|
||||
doublon = 1;
|
||||
}
|
||||
}
|
||||
if(doublon == 0){
|
||||
printf("%.2lf, ", comp);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
free(p);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
33
23DEV1.1/TPS1/TP2/18-AllocationDynamique/Singletons.c
Normal file
33
23DEV1.1/TPS1/TP2/18-AllocationDynamique/Singletons.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int num;
|
||||
int i, j;
|
||||
double comp;
|
||||
double in;
|
||||
int doublon;
|
||||
printf("Combien de réel à rentrée ? ");
|
||||
scanf("%d", &num);
|
||||
double* tab = (double*) calloc(num, sizeof(double));
|
||||
for(i=0;i<num;i++){
|
||||
printf("case %d : ", i);
|
||||
scanf("%lf", tab+i);
|
||||
printf("\n");
|
||||
}
|
||||
for(i=0;i<num;i++){
|
||||
doublon = 0;
|
||||
comp=tab[i];
|
||||
for(j=0;j<num;j++){
|
||||
if((*(tab+i) == *(tab+j) && (tab+i) != (tab+j))){
|
||||
doublon = 1;
|
||||
}
|
||||
}
|
||||
if(doublon == 0){
|
||||
printf("%.2lf ", comp);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
free(tab);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
BIN
23DEV1.1/TPS1/TP2/18-AllocationDynamique/a.out
Executable file
BIN
23DEV1.1/TPS1/TP2/18-AllocationDynamique/a.out
Executable file
Binary file not shown.
Reference in New Issue
Block a user