This is the source code for understand the simple function of array.
Here we have to calculate the average temperature of 7 days using array in c++.
#include<iostream.h>
#include<conio.h>
main()
{
float temp[7],sum=0;
int i=0;
while(i<=6)
{
cout<<"enter the temp. of day"<<i+1<<"?"<<endl;
cin>>temp[i];
sum=sum+temp[i];
i++;
}
cout<<"\nAverage temperature :"<<sum/7.0;
getch();
}
End