1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
| #include <stdio.h>
#include <stdlib.h>
#include "struct.h"
#include "file.h"
#include "interpolation.h"
int main (int argc, char **argv)
{
if (argc != 2)
{
printf("\nLes arguments entres sont invalides\n"
"NB: ./'executable' 'nom du fichier' 'parametre'\n\n");
exit(EXIT_FAILURE);
}
printf("\n\t-----------------------------------------\n"
"\t| Projet 7 - Interpolations numeriques |"
"\n\t-----------------------------------------\n\n");
char txtFile[55], answer;
int tmp = 0, checkTg = 0, menu = 0;
Coordinate *point;
FILE *txt;
sprintf(txtFile, "%s.txt", argv[1]);
openTxt(&txt, txtFile);
printf("Le fichier entre, contient-il des valeurs de tangentes ? y/n\n");
while (answer != 'y' || answer != 'n')
{
scanf("%c", &answer);
if (answer == 'y')
{
checkTg = 1;
break;
}
if (answer == 'n')
{
checkTg = 0;
break;
}
else
{
while((tmp = getchar()) != '\n' && tmp != EOF);
printf("Veuillez repondre par y (yes) ou n (no)\n");
continue;
}
}
//REMPLISSAGE DE LA STRUCTURE ---------------------------------------------
int nbrPoint = 0;
fscanf(txt, "%d ", &nbrPoint);
//printf("1 %d \n", nbrPoint);
point = malloc(nbrPoint*sizeof(Coordinate));
readTxt(&txt, point, checkTg, nbrPoint);
/*for (i = 0; i < nbrPoint; i++)
{
fscanf(txt, "%d %d", &point[i].x, &point[i].y);
printf("1 %d %d \n", point[i].x, point[i].y);
if (checkTg == 1)
{
fscanf(txt, " %d", &point[i].tg);
}
}*/
//-------------------------------------------------------------------------
fclose(txt);
if (checkTg == 1)
{
printf("\nChoix disponibles :\n\n"
"1. Interpolation Lineaire\n"
"2. Interpolation de Hermite\n"
"3. Interpolation de Lagrange\n"
"4. Courbe de Bezier\n\n");
scanf("%d", &menu);
switch (menu)
{
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
default:
break;
}
}
if (checkTg == 0)
{
printf("\nChoix disponibles :\n\n"
"1. Interpolation Lineaire\n"
"2. Courbe de Bezier\n\n");
scanf("%d", &menu);
switch (menu)
{
case 1:
//linearInt (point, line, nbrPoint);
break;
case 2:
break;
default:
break;
}
}
return EXIT_SUCCESS;
} |
Partager