// This program reads in an integer array from a text file 
// Then prints it to the screen to verify it has been read in
// This was created by Evan Lemley 10/23/07

#include <stdio.h>
#include <math.h>

#define NROWS 10
#define NCOLS 7
#define FILENAME "POWER1.DAT"

int main(void)
{
	/* Declare variables*/
	FILE *POWER1;
	int array[NROWS][NCOLS];
	int row, col;
	
	//Open the file
	POWER1 = fopen(FILENAME, "r");
	
	//Make sure the file opened properly
	if (POWER1 == NULL)
		printf("Error opening input file\n");
	else
	{
		//Read in the array values
		for (row=0; row<NROWS; row++)
		{
			for(col=0; col<NCOLS; col++)
			{
				fscanf(POWER1,"%i",&array[row][col]);
			}
		}

		//Write out the array values (in a nice form)
		printf("\n");
		for (row=0; row<NROWS; row++)
		{
			for(col=0; col<NCOLS; col++)
			{
				printf("%5i",array[row][col]);
			}
			printf("\n");			
		}
		
	}
	/* Exit Program */
	return 0;
}








