Hi, I'm trying to incorporate a program title and welcome message into my code and I'm not sure if I have done it correctly. I would also like to know how to incorporate the following function calls into my code:
Call Personnel Age
Call Calculate Average Age
Call Display Average Age
#include <iostream>
using namespace std ;
int main ()
{
int Age[50] ; // age of personnel
int I ; // number of ages entered
int sum ; // sum of ages
float Average ; // average of ages entered
"Active Duty Navy personnel Program"
"This program will find the average age of fifty AD Navy Personnel"
sum = 0 ;
Average = 0 ;
for (I = 0 ; I < 50 ; I++)
{
cout << "Enter current age of AD Navy Personnel" << ( I + 1 ) << endl ;
cin >> Age[I] ;
if ( Age[I] >=18 ){
sum = sum + Age[I] ;
}
else {
I = I - 1 ; // the same element the Age array will be read
}
Average = sum/50 ;
for ( I = 0 ; I < 50 ; I ++ )
{
cout << "Age of Personnel" << ( I + 1 ) << "is : "
<< Age[I] << endl ;
}
cout << "The current average age of AD Navy Personnel is : "
<< Average << endl ;
return (0); // terminate with success
}
Thanks in advance!!!