Help with putting data into an array
Hi guys and gals,
I'm new hear and to programming. I'm currently taking a class but I need a little help getting data from a txt file and putting it into array for me to be able to work with it. Here is sample of the code the teacher provides. The bottom section is the data that would be on the txt file.
#include <stdio.h>
#include "perry.h"
#define MAXNAME 41 /* Extra slot for \0 char that ends all strings!! */
#define MAXSCORES 9 /* Extra slot for -1 sentinel. */
#define MAXFILE 81
int main(void)
{
char infile[MAXFILE], outfile[MAXFILE];
FILE *fin, *fout;
void produceAverageAndVarianceFile(FILE *fin, FILE *fout);
printf("Enter input filename: ");
scanf("%s", infile);
printf("Enter output filename: ");
scanf("%s", outfile);
fin = Fopen(infile, "r");
fout = Fopen(outfile, "w");
produceAverageAndVarianceFile(fin, fout);
}
/*Smith,Joe 7 77 86 89 90 76 90 84
Jones,Ed 5 65 56 77 59 66
Thomas,Chris 5 58 90 77 92 88
Doinck,Wilson 3 44 48 58
Dover,Ben 7 43 87 84 99 39 49 94
Wonka,Willie 8 47 85 80 56 76 92 85 67
Stein,Franken 6 75 72 78 81 82 99
Franklin,Ben 7 100 100 99 76 98 89 93
Wilson,James 1 88*\
[/CODE]
I'm a little confused with there being char and int in the data. If you can help out that would be great. Thank you