Thread: Parse Error

  1. #1
    Auburn University Student
    Join Date
    Oct 2005
    Posts
    1

    Parse Error

    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",&times[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");
    	
    }

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Count your braces pairs. Oh, while you're at it: learn to indent correctly! That's ........ing horrible to try and read.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. How to monitor process creation?
    By markiz in forum Windows Programming
    Replies: 31
    Last Post: 03-17-2008, 02:39 PM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 05:45 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM