1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
int main()
{
const int NUM_COMPANIES = 6;
const int NUM_QUARTERS = 4;
void writeData(double[][NUM_COMPANIES], string[], int, int); //function prototype
string companyNames[NUM_COMPANIES] = { "ABC", "DEF", "GHI", "JKL", "MNO", "###" };
//declare a one dimensional string array to hold the names of 6 different companies
double salesData[NUM_QUARTERS][NUM_COMPANIES] =
//a 2D double array to hold the sales data for the four quarters in a year
{ { 40000, 50000, 60000, 70000 },
{ 35000, 45000, 55000, 65000 },
{ 25000, 26000, 27000, 28000 },
{ 31000, 32000, 33000, 34000 },
{ 42000, 43000, 44000, 45000 },
{ 10000, 20000, 30000, 40000 } };
writeData(salesData, companyNames, NUM_COMPANIES, NUM_QUARTERS);
system("pause");
return 0;
|