I am new to this board and I have a question, I am trying to do a two-dimensional array, and I keep coming up with an error that says "parse error at the end of input" Just in case if you need it, here is my program
/*Joshua Delaney
File Name: delanjl7.c
COMP 1200: Fall 2005
Assignment 7
To Create a two-dimensional array of bearing failures*/
#include <stdio.h>
#include <math.h>
#define FILENAME "bearings.txt"
#define NCOLUMNS 3
#define NROWS 7
/*Function prototypes*/
void underlines();
Code:
int main()
{
/*Variable Declarations*/
FILE *bearings;
int x,y=0,c,d;
float times[7][3];
float average;
/*This reads the text from the bearings file*/
bearings=fopen("bearings.txt","r");
if(bearings==NULL)
{
puts("Man, You know that is wrong, what in the world were you thinking?!?!");
}
else
{
while(fscanf(bearings,"%f",×[7][3])!= EOF)
{
y++;
if (y==NCOLUMNS) {
y=0;
x++;
}
}
/*This will print header and underlines*/
underlines ();
printf(" Failure Times of Bearings\n");
underlines ();
printf("\n%10s%20s%20s%20s%\n", "Alpha", "Beta", "Gamma", "Average");
printf("\n%10s%20s%20s%20s%\n", "Bearing", "Bearing", "Bearing", "Bearing");
/*this function prints the array*/
for(x=0; c<x; x++)
{
for(y=0; d<NCOLUMNS; y++)
{
printf("%d", times[x][3]);
}
printf("\n");
for(y=0; y<=NCOLUMNS-1; y++)
{
for(x=0; x<=NROWS-1; x++)
{
float Average = (x + y)/NCOLUMNS;
printf("Average=%.2f\n", average);
}
underlines ();
fclose(bearings);
return 0;
}
void underlines ()
{
printf("-------------------------------------------------------------------\n");
}