Hey there, I was wondering if I could get some help with this program. Everything works perfect except im having trouble thinking of how to get this thing to display a table graph
#include <iostream>
using namespace std;
const int MONTHS = 12;
void getAverageRainfall(int avg[], int size);
void getActualRainfall(int act[], int size);
void displayBarGraph(int avg[], int act[], int size);
int main()
{
int average[MONTHS] = {0};
int actual[MONTHS] = {0};
int choice;
cout << "This program accepts average and actual rainfall data.\n";
cout << "Then the program will display the data in tabular or\n";
cout << "bar-graph form, along with the difference in rainfall.\n\n";
getAverageRainfall(average, MONTHS);
getActualRainfall(actual, MONTHS);
do
{
cout << "*** Rainfall Display ***\n";
cout << "1. Bar-graph Display\n";
cout << "2. Tabular Display\n";
cout << "0. Exit\n\n";
cout << "Enter choice: ";
cin >> choice;
switch (choice)
{
case 1:
displayBarGraph(average, actual, MONTHS);
break;
case 2:
displayTabularGraph(average, actual, MONTHS);
break;
case 0:
cout << "Rainfall Display Program done.\n";
break;
default:
cout << "Invalid choice. Try again.\n";
}
} while (choice != 0);
system("Pause");
}
void displayTable(int avg[], int act[], int size)
{
declare counter for use with arrays
cout << " *** Rainfall Table ***/n";
cout << "Month\tActual\t\tAverage\t\tDifference";
cout <<"------\t------\t---------\t-----------\n;
//use for loop from 0 to size
// Display value from avg[], act[], avg[] - act[]
I deleted pretty much all of the program that works except for parts I thought you would need.
As you can see, my professor gave me a lot of tips of what to do...but...IDK..I just don't understand...like...how would using a for loop creating a tablular graph? Any help would be greatly appreciated