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
The term that refers to the standard computer language for creating web pages is called:
Pavel [41]

Answer:

Language programming Web's programming language

Explanation:

6 0
4 years ago
1. My grandma and I went shopping to look for old
docker41 [41]

Answer:

uncommon

Explanation:

it's not common or usual because no one else finds the things

it's not kind because inanimate objects don't show feelings

6 0
2 years ago
The pseudo-class selectors for links let you use CSS to change the formatting for all but one of the following. Which one is it?
aev [14]
B. A link that is inactive
7 0
3 years ago
Why is it essential for every person living in the 21st century to have a computer​
Zolol [24]

Answer: because computers are our main source of communicating and where we find a wide range of information to help us

Explanation:

4 0
3 years ago
Read the following scenario and decide whether it is fair use and why Donnie has a major paper do for school he finds a great we
ss7ja [257]

Answer:

(A) and (B) I'm leaning more towards (B)

Explanation:

5 0
3 years ago
Other questions:
  • To copy consecutive items, click the first item in the group, hold down _______, and click the last item
    7·2 answers
  • The tools that cyber criminals often use, including computer viruses, worms, trojan horses and spyware, are called __________. q
    5·1 answer
  • Which is the best practice for placing graphics on a slide?
    6·2 answers
  • Omega Software Inc. is currently running a training program for employees to upgrade their software skills so that they are able
    10·1 answer
  • Easy upgrade from windows xp to windows 7
    7·1 answer
  • Can you answer the fill in the blanks
    15·2 answers
  • The term wiki refers to a(n): Group of answer choices type of short-message blogging, often made via mobile device and designed
    9·1 answer
  • What is the maximum number of characters you can have in a file name​
    8·1 answer
  • When using a small mic that attaches to your interview subject, where should you place that mic and why?
    5·1 answer
  • Which memory can be removed from motherboard? RAM OR ROM?​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!