1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
victus00 [196]
3 years ago
9

Assume that PrecinctReport is a structured type with these fields, address (a string), and three int fields which are counts of

crimes in the given precinct: felonies, murders, and robberies. Assume that NPRECINCTS is a pre-declared int constant and that an array named allPrecincts with NPRECINCTS elements, each of type PrecinctReport has been declared and initialized Assume that an int variable murderCount has been declared. Write the necessary code that traverses the allPrecincts array and adds up all the murder counts storing the resulting total in murderCount.
Computers and Technology
1 answer:
monitta3 years ago
8 0

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;

}

You might be interested in
Select all that apply. Two physical things you can do to demonstrate you are paying attention to a speaker are _____ and _____.
omeli [17]
B and d ............
7 0
3 years ago
Read 2 more answers
In 3–5 sentences, describe how good e-mail work habits increase workplace efficiency and productivity.
Ket [755]
Faster communication, information spread faster, group messages
6 0
3 years ago
What game is this? help meee
olya-2409 [2.1K]

Answer:

I am guessing animal crossing

4 0
3 years ago
Read 2 more answers
Suppose there are two ISPs providing WiFi service in a café. Each ISP operates its own AP and has its own IP address block. If b
Alinara [238K]

Answer:

As a design rule, access points within range of each other should be set to channel frequencies with minimal signal overlap. Users will find that roaming doesn’t work well, and performance will degrade because of interference between access points.

Explanation:

8 0
4 years ago
Plz help
Rama09 [41]

Answer:

name

Explanation:

name =

is an assignment to the variable called 'name'.

5 0
3 years ago
Read 2 more answers
Other questions:
  • For what show did the actor, whose star is located at 6667 Hollywood Boulevard, earn an Emmy Award for Outstanding Supporting Ac
    10·2 answers
  • Print "Censored' if userlnput contains the word "darn, else print userlnput. End with newline. Ex: If userinput is "That darn ca
    11·1 answer
  • Which of the following best describes the purpose of child labor laws?
    13·2 answers
  • In which contingency plan testing strategy do individuals participate in a role-playing exercise in which the CP team is present
    10·2 answers
  • #11. Write a program that prompts the user to input a four-digit positive integer. The program then outputs the digits of the nu
    6·1 answer
  • Assume that a is an array of two or more integers, and that b and c are integers.
    13·1 answer
  • This is in government
    15·1 answer
  • An insurance company utilizes SAP HANA for its day-to-day ERP operations. Since they can’t migrate this database due to customer
    5·1 answer
  • What is this....... Iam booking train to patna. ​
    13·2 answers
  • 300134223+304532264440=
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!