Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that prints the frequency (# of occurrences) of each unique number inside a given set of numbers. For example: Given set of

Write a program that prints the frequency (# of occurrences) of each unique number inside a given set of numbers. For example: Given set of {1,1,2,2,2,4,5,5,7,7,7}, your program should output: 1:2 2:3 4:1 5:2 7:3 Your program will be based on the following template. Copy this code as your starting point for your code. Use the test vector given in the main function. Make sure you put in the correct header files and function prototypes. Complete each function to implement the desired results. **********************************************************************************

include your headers here

int main() {

std::vector tst = {1,2,1,3,3,2,3,2,4}; // our test array

printFrequency(tst); return 0;

}

// Helper function that returns how many of item is in

// the input array.

int countItem( put arguments here...) {

int count = 0; // initialize the counter variable to zero

put your code here

return count;

}

// Function that prints out the frequency of each unique

// item in the input array

void printFrequency( put arguments here...) {

put your code here

}

I know, how to code it using only the main function; however, the assignment requires the use of main, printFrequency, and countItem. The use of functions confuses me so I can't figure out how to implement this into code using three functions.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

What is meant by decentralisation of authority ?

Answered: 1 week ago

Question

Briefly explain the qualities of an able supervisor

Answered: 1 week ago

Question

Define policy making?

Answered: 1 week ago

Question

Define co-ordination?

Answered: 1 week ago

Question

What are the role of supervisors ?

Answered: 1 week ago