I need to come up with a program that will read four quarterly sales amounts of six branches of a company from an input file. The sales amount read from the input file should be stored in a two-dimensional array.
A sales report should show the following: quarterly sales per branch, sales differences from the previous quarter per branch, total sales per quarter, average sales of all branches per quarter, and the branch and associated sales amount having the highest sales volume per quarter. What I'm not sure how to do is pull the array from the file and then use those values to calculate the needed information. This is what I have so far: (sorry I forgot how to properly copy my code into here) Did I scan for the array correctly?
#include <iostream>
#include <stdio.h>
#define FILENAME "sales.dat"
using namespace std
int i, j, money;
double avg, tot, diff, S[6][4]
FILE *Sales
int main(void)
{
Sales = fopen("sales.dat", "r")
if (Sales == NULL)
printf("Error loading file. \n");
else
{
for (i=0, i<=5, i++0)
for (j = 0, j <= 3, j++)
fscanf(Sales, "%i", &S[i][j]);