I am trying to input a data file into C++ such that it will appear as 2 arrays of maximum value 100... so far, this is what I have...

void readfile(double x[], double y[], double sigma[], int * entries)
/* read data into x[] and y[]
fill sigma[] with 1's
determine the value of entries */
char name[40];
FILE *data;
printf("Enter the name of the data file: ");
if ((data=fopen(name,"r"))==NULL) {
printf("Can't open file %s.\n",name);
exit(1); // Exits program
// Assume data file contains 2 columns of data with no header
while (*entries<MAXDATA &&
fscanf(data,"%lf %lf",&x[*entries],&y[*entries])==2) {
if (fclose(data)) printf("Error in closing data file.\n");

I am a student learning to use this program, and I could really use some help! Thanks everyone...

Your code is C. This is a C++ forum.

It looks like it should do what you ask.

Does it run? Does it give the results you want? What's your question?

And, when you post code, please put it between code tags, thusly


your code goes here


You want to know how this program works????