Answer:
Explanation:
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
const int NPRECINCTS = 5;
typedef struct PReport
{
string address;
int felonies, murders, robberies ;
}PrecinctReport;
int murderCount(PrecinctReport all[])
{
int sum=0;
for(int i=0;i<NPRECINCTS;i++)
sum+=all[i].felonies + all[i].murders + all[i].robberies;
return sum;
}
int main()
{
PrecinctReport allPrecincts[NPRECINCTS];
for(int i=0;i<NPRECINCTS;i++)
{
cout<<"Enter the address of the "<<i+1<<": ";
cin>>allPrecincts[i].address;
cout<<"\nEnter the felonies of the "<<i+1<<": ";
cin>>allPrecincts[i].felonies;
cout<<"\nEnter the murders of the "<<i+1<<": ";
cin>>allPrecincts[i].murders;
cout<<"\nEnter the robberies of the "<<i+1<<": ";
cin>>allPrecincts[i].robberies;
cout<<"\n \n";
}
cout<<"Total murders : "<<murderCount(allPrecincts)<<endl;
return 0;
}