41 lines
691 B
C
41 lines
691 B
C
#include<stdio.h>
|
|
#include<stdlib.h>
|
|
#include<string.h>
|
|
|
|
int main(int argc, char * argv[]) {
|
|
printf("Veuillez donner vos valeurs : \n");
|
|
double* list = (double*) calloc(1, sizeof(double));
|
|
int size = 1;
|
|
|
|
do {
|
|
char reel[50];
|
|
scanf("%s", &reel);
|
|
if (reel[0] == 'q') break;
|
|
|
|
int found = 0;
|
|
double var = strtod(reel, NULL);
|
|
for (int i = 0; i < size; i++) {
|
|
if (list[i] == var) found = 1;
|
|
}
|
|
|
|
if (!found) {
|
|
list[size-1] = var;
|
|
|
|
size++;
|
|
double* new_list = (double*) realloc(list, size * sizeof(double));
|
|
list = new_list;
|
|
}
|
|
|
|
} while(1);
|
|
|
|
for (int i = 0; i < size-1; i++) {
|
|
printf("%f ", list[i]);
|
|
}
|
|
|
|
printf("\n");
|
|
free(list);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|