GIDForums  

Go Back   GIDForums > Computer Programming Forums > CPP / C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 10-Apr-2007, 20:40
zerrigan zerrigan is offline
New Member
 
Join Date: Apr 2007
Posts: 3
zerrigan is on a distinguished road

Trouble displaying table graph


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

CPP / C++ / C Code:
#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
 
 

Recent GIDBlogA Week in Kuwait by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfer longblob from one table to another table Richardknox MySQL / PHP Forum 6 13-Dec-2006 04:26
Cannot create a table in DB WaltP MySQL / PHP Forum 3 26-Apr-2006 16:09
how to get Call graph for applications, anybody knows bravetanveer C Programming Language 1 29-Sep-2005 23:27
Hash Table & Graph Kay Chan CPP / C++ Forum 7 08-Oct-2004 07:44
[Tutorial] MySQL Basics nniehoff MySQL / PHP Forum 15 23-Mar-2003 19:42

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:21.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.