I am having problems trying to display the code. It is for part of my homework. I will give the link to the problem and the problem demmo and see if someone can help me. I've looked everywhere for help on this one and couldn't find it. On page 22 or 134 Lab 7.4 option 1 is where I am at. The Link is here http://www.harding.edu/ragsdale/comp151/lm_chapter%2007.pdf
#include <iostream>
usingnamespace std;
constint MAX_TOTAL_AGES = 100;
typedefint ageType[MAX_TOTAL_AGES];
void finalData ( const ageType, int );
int main ()
{
ageType age;
int pos =0;
int numberOfAges;
cout << "Please input an age from one to 100, put -99 to stop ";
cin >> age[pos];
do
{
pos++;
cout << "Please input an age from one to 100, put -99 to stop ";
cin >> age[pos];
}while (age[pos] != -99);
numberOfAges = pos;
finalData(age,numberOfAges);
return 0;
}
void finalData ( const ageType array , int size )
{
staticint num = array[0];
int tot = 0;
int counter = 0;
for (int i = 0; i < size; i++ )
{
for (int j = 0; j < size; j++)
{
if(array[i] == array[j])
{
counter++;
cout << "The number of people " << array[i] << " years old is " << counter << endl;
}
counter = 0;
}
}
}