i have a small problem any help

//hi guys ... i'm trying to fine answer for this problem at this code here

#include <iostream>
using namespace std;
int main ()
{
int hi[300] , p ;

for (int a=0 ;a<300;a++) // to list the no of height
hi[a]=0 ;
cout <<"Enter number of student \n";
cin >> p ;

for ( int i=1 ; i<=p ; i++ ) // no 1 no 2 no3 no4 no5
{
cout << "enter the height of student no . "<<i<<"\n" ;
int height ;
cin >> height ;
hi[height]++ ;
}
float avg=0 ;
for(int i=100 ; i<= 200 ; i++ )
{
cout << i << " " << hi[i]<<"\n";

avg+=i*hi[i]/p ; //<-------------------------
}

cout<< "the avarage height is " << avg << "\n";

system ("pause");


}

why he say avg+ if any buddy knows why please tell me i will be so thankful

i'm witting .........
i also couldn't find answer for it




 
avg += i*hi[i]/p;
is the same as
 
avg = avg + (i*hi[i]/p);
oh i just renumber it when i saw your replay

thanks allot for helping really I appreciate it.
Topic archived. No new replies allowed.