ok bon je ne mettrait plus d'image. Bon pour le code je ne pense pas avoir fait de connerie mais la voici: (je previens c loin d'etre du grand art et d'un haut niveau intellectuel)
#include
<iostream>
#include
<stdio.h>
#include
<stdlib.h>
using
namespace std;
FILE * open;
int
xRead;
float
yRead;
int
i, endfile;
int
N;
int
readfile(void)
{
open = fopen("tab1.txt","r");
i = 0;
DefineN:
endfile = feof(open);
if (endfile == 0)
{
i++;
fscanf (open,"%d ",&xRead);
fscanf (open,"%f\n",&yRead);
goto DefineN;
}
else
{
fclose(open);
}
return
i;
}
int
main ()
{
int
*x;
float
*y;
N = readfile();
cout << N << endl;
x=(
int *)calloc(N,(sizeof(int)));
y=(
float *)calloc(N,(sizeof(float)));
if
(x==NULL)
{
cout<<"pas assez de mémoire"<<endl;
goto end;
}
if
(y==NULL)
{
cout<<"pas assez de mémoire"<<endl;
goto end;
}
open = fopen("tab1.txt","r");
i = 0;
for
(int cpt = 1; cpt <= N; cpt = cpt++)
{
fscanf (open,"%d ",&xRead);
x[cpt] = xRead;
//cout << xRead << endl;
fscanf (open,"%f\n",&yRead);
y[cpt] = yRead;
//cout << yRead << endl;
}
fclose(open);
for (int cpt = 1;cpt <= N;cpt = cpt++)
{
printf("X%d egal %d\n",cpt,x[cpt]);
printf("Y%d egal %f\n\n",cpt,y[cpt]);
}
end:
cin.ignore();
free(x);
free(y);
return
0;
}