Answer:
Step-by-step 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<<"\\Enter the felonies of the "<<i+1<<": ";
cin>>allPrecincts[i].felonies;
cout<<"\\Enter the murders of the "<<i+1<<": ";
cin>>allPrecincts[i].murders;
cout<<"\\Enter the robberies of the "<<i+1<<": ";
cin>>allPrecincts[i].robberies;
cout<<"\\ \\";
}
cout<<"Total murders : "<<murderCount(allPrecincts)<<endl;
return 0;
}