need guidance on how to finish program

Instructions:
--For each day, tell which balloon (identify it by time released) traveled the greatest distance on that day (7 values printed). Identify the day by name rather than by number.
--For each day, calculate and print the average distance (print one decimal position) traveled by all balloons released on that day which were actually recovered hose for which distance > 0) (7 values printed). Identify the day by name rather than by number.
--Calculate and print the average distance (print one decimal position) traveled by all the balloons which were recovered during the entire week (1 value printed).
--I am pulling my information from a file where its listed like:
4 1200 182
4 1800 42
7 1500 284
first column means day
second column means time
third column means distance traveled
I am very new to c++ and still learning a lot. I am using bloodshed Dev c++ Thanks for your time

Here is my code: You don't have to tell me the answer I just need guidance on completing the program like should I use switch statements, more void function, etc.

#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;

const int DAYS=7; // Global constants
const int TIME=5;

// function prototypes
void getInfile( double distance [DAYS][TIME]);
void avgDistance(double distance[][TIME]);
void dayRelease(double distance[][TIME]);
int maxDistance(double distance [][TIME], int);
void printHeading(string[]);


int main()
{
string dayNum[DAYS]= { " Sun. ", " Mon. ", " Tues. ", " Wed. ", " Thurs. ", " Fri. ", " Sat. "};
string timeRelease[TIME]= { " 600 ", " 900 ", " 1200 ", " 1500 ", " 1800 "};

double distance[DAYS][TIME]; // 2D array for storing the distance values
int day; // row subscript for distance array
int time; // column subscript for distance array
int max; // subscript for the largest distance in a row
double sum;
double totalSales;



getInfile (distance); // Input values to fill the store array.
printHeading(dayNum);

for (day = 0; day < DAYS; day++) // For each day
{

max = maxDistance (distance, day); // find the largest distance in distance array
sum = dayRelease(distance, day);

cout << setw(15) << left << timeRelease[TIME];

for (time = 0; time < TIME; time++)
cout << setw(10) << right << distance [day][time];

cout << setw(10) << sum << " " << left << dayNum[max] << endl;
}



system("pause");
}

Last edited on
Topic archived. No new replies allowed.