C++ program Showing multi-dimensional array





This program is an example for multi-dimensional array. Array can be defined as a group of similar objects, refrenced by the common name.

This is a program to read sales of 10 districts in 12 months and calculate total sales of each district.

#include<iostream.h>

#include<conio.h>

Void main ()

{

Int district =10;

Int month =12;

Float sales [district] [month];

Int I, j;

Float total;

For (=0; i<10; i++)

{

Total=0;

For (j=0; j<12; j++)

{

Cout<<”\n enter sales for district”<<i+1<<”for month”<<j+1;

Cin>>sales [i] [j];

Total= total +sales [i] [j];

}

Cout<<”\n total sales of district”<<i+1<<”=”<<total;

}

getch ();

}



Related posts:

  1. C++ Program To Display Result Stored In An Array This program takes ‘n’ number as input , stores it...
  2. C++ Program To Display Content of Array This program is used to initialize a set of string...
  3. C++ Program showing constructor overloading Constructor is a member function with the same name as...
  4. Array of structure Array of structure It is well known that array is...
  5. Array Of Class Object Array of class objects Array is a collection of similar...