Code:
#include <stdio.h>
#include <string.h>
const int rows=4;
const int cols=12;
float num[rows][cols];
float total, arraytotal;
FILE *fp;
main()
{
if((fp = fopen("array.txt","r"))==NULL)
printf("error opening file\n");
else
{
for(int i=0;i<rows;i++)
{
total=0;
printf("\n\n\t\t");
for(int j=0; j<cols; j++)
{
fscanf(fp,"%f",&num[i][j]);
printf("%7.2f",num[i][j]);
total=total+num[i][j];
}
printf("%7.2f",total);
}
arraytotal=0;
printf("\n\n\n\t\t");
for(int j=0; j<cols; j++)
{
total=0;
for(int i=0; i<rows; i++)
total=total+num[i][j];
printf("%7.2f",total);
arraytotal=arraytotal+total;
}
printf("%7.2f", arraytotal);
}
getchar();
}
as it stands this reads in the numbers into the array , calculates the row total and the column total
as for getting it to read a string of letters at the start im completely stumped