In a previous homework assignment, you solved Exercise 5.5, Problem 12 (on Page 287 of Fourth Edition). Now, you are to write a new program which solves this same problem, but instead of using counters named zerocount, onecount, twocount, etc., you are to use an array of 10 counters. For example: int counts[10]; Before you write this new program, please review any comments I made when I graded your previous homework assignment and don't make any of the same mistakes in this new program.
In a previous homework assignment, you solved Exercise 5.5, Problem 12 (on Page 287 of Fourth Edition). Now, you are to write a new program which solves this same problem, but instead of using counters named zerocount, onecount, twocount, etc., you are to use an array of 10 counters. For example: int counts[10]; Before you write this new program, please review any comments I made when I graded your previous homework assignment and don't make any of the same mistakes in this new program.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
That is the previous homework (second image)
![In a previous homework assignment, you solved Exercise 5.5, Problem 12 (on Page 287 of Fourth Edition). Now,
you are to write a new program which solves this same problem, but instead of using counters named
zerocount, onecount, twocount, etc., you are to use an array of 10 counters. For example:
int counts[10];
Before you write this new program, please review any comments I made when I graded your previous
homework assignment and don't make any of the same mistakes in this new program.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F857e59ec-a41c-482c-b479-1110f08e55fb%2Fa8c9a2a2-b7d0-4784-8982-89f8a0891bab%2F5u5w92qs_processed.png&w=3840&q=75)
Transcribed Image Text:In a previous homework assignment, you solved Exercise 5.5, Problem 12 (on Page 287 of Fourth Edition). Now,
you are to write a new program which solves this same problem, but instead of using counters named
zerocount, onecount, twocount, etc., you are to use an array of 10 counters. For example:
int counts[10];
Before you write this new program, please review any comments I made when I graded your previous
homework assignment and don't make any of the same mistakes in this new program.

Transcribed Image Text:#include <iostream>
#include <cstdlib>
#include <ctime>
7 using namespace std;
int main()
10 - {
11
int zerocount= ®, onecount= 0, twocount= 0, threecount= 0, fourcount= 0, fivecount= 0, sixcount= 0,
12
sevencount=
e, eightcount= 0, ninecount= 0;
int number;
e;
13
14
int total
15
// generating 10000 random number
for ( int i = 0; i < 100000; ++i)
{
number = rand () % 10;
16
17
18 -
19
20
if (number -- 0) zerocount++;
else if (number == 1) onecount++;
2) twocount-
else if (number == 3) threecount++;
else if (number == 4) fourcount++;
else if (number == 5) fivecount++;
6) sixcount++;
7) sevencount++;
else if (number == 8) eightcount++;
(number == 9) ninecount++;
21
22
23
else if (number
24
25
26
else if (number
else if (number
27
28
29
30
else
31
}
32
33
total = zerocount + onecount + twocount + threecount + fourcount + fivecount + sixcount + sevencount + eightcount + ninecount;
34
cout << "Number of e values generated -
cout <« "Number of 1 values generated
cout <« "Number of 2 values generated
cout <« "Number of 3 values generated
cout <« "Number of 4 values generated
cout <« "Number of 5 values generated
cout <« "Number of 6 values generated
cout <« "Number of 7 values generated
<< "Number of 8 values generated
<< "Number of 9 values generated =
<« zerocount <« "(" << 100*zerocount
<« onecount << "(" <« 100*onecount
<« twocount « "(" <« 100*twocount
<« threecount <« "(" < 100*threecount
" « fourcount <« "(" <« 100*fourcount
<« fivecount << "(" << 100*fivecount
<« sixcount <« "(" << 100*sixcount
" <« sevencount << "(" << 100*sevencount
" « eightcount << "(" << 100*eightcount / (01.0*total) <« "%)
<« ninecount
(01.0*total) « "%)" << end1;
(01.0*total) « "%)" << endl;
(01.0*total) « "%)
(01.0*total) « "%)
(01.0*total) « "%)" << endl;
(01.0*total) « "%)"
(01.0*total) « "%)"
(01.0*total) « "%)"
35
36
<« endl;
<« endl;
37
38
39
<« endl;
<« endl;
40
41
endl;
<« endl;
<« endl;
42
43
cout
44
cout
<« "(" <« 100*ninecount / (01.0*total) <« "%)"
45
46
return e;
47
}
48
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY