DEV/DEV1.1/TP09/sigletons.c

48 lines
779 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char const *argv[]){
int x;
double temp;
printf("Combien de reel souhaitez vous rentrez ? : \n");
scanf("%d",&x);
double listChiffre[x];
for(int i=0;i<x;i++){
printf("rentrez le réel num %d : \n",i+1);
getchar();
scanf("%lf",&temp);
listChiffre[i]=temp;
}
int lastI = 0;
int dejavuuu;
double dejavu[x];
for (int i = 0; i < x; ++i)
{
dejavuuu=0;
for(int j = 0; j < sizeof(dejavu)/sizeof(double); ++j)
{
if (listChiffre[i]==dejavu[j])
{
dejavuuu++;
dejavu[j]=-1;
}
}
if (dejavuuu==0)
{
dejavu[lastI]=listChiffre[i];
lastI++;
}
}
for (int i = 0; i < lastI; ++i)
{
if (dejavu[i]!=(-1))
{
printf("%lf ",dejavu[i]);
}
}
return 0;
}