If a problem says write the code to create two arrays for storing the number of students at each age.
-studentDistrib for studentAge
-theirStudentDistrib for theirStudentAge
is it double studentDistrib[studentAge]
and
double theirStudentDistrib[theirStudentAge]
then if i want to update the elements of studentDis and theirStudentDis
for(int student=0; student<studentDistrib; student++)
{
double age =0;
cout<< "put age ";
cin>>age;
cout<<studentDistrib[student]<<" is "<<age;
}
// arrays example
#include <iostream>
usingnamespace std;
int billy [] = {16, 2, 77, 40, 12071};
int n;
int main ()
{
cout << "The original Array is: ";
for ( n=0; n<5 ; n++){
cout << billy[n] << " , ";//print out original array's elements
}
cout << "\n";
for ( n=0 ; n<5 ; n++ )
{
billy[n] = billy[n] + 1;//adding 1 to each element in the array
}
cout << "The updated Array is: ";
for ( n=0; n<5 ; n++){
cout << billy[n] << " , ";//print out the udpated array's elements
}
return 0;
}