answersLogoWhite

0

#include<iostream>

#include<vector>

#include<list>

#include<map>

#include<time.h>

int main()

{

srand ((unsigned)time(nullptr));

// Create a list of 100 values in the range 0 to 9.

std::cout << "Number list:\t";

std::list<size_t> numbers;

for (size_t i=0; i<100; ++i)

{

numbers.push_back (rand()%10);

std::cout << numbers.back() << ' ';

}

std::cout << '\n' << std::endl;

// Determine position(s) of each number.

std::map<size_t, std::vector<size_t>> map;

size_t pos = 0;

for (auto it=numbers.begin(); it!=numbers.end(); ++it)

map[*it].push_back(pos++);

// Print number, frequency and position(s).

for (auto it=map.begin(); it!=map.end(); ++it)

{

std::cout << "Number:\t\t" << (*it).first << std::endl;

std::cout << "Frequency:\t" << (*it).second.size() << std::endl;

std::cout << "Postions:\t";

const std::vector<size_t>& positions = (*it).second;

for (auto it=positions.begin(); it!=positions.end(); ++it)

std::cout << (*it) << ' ';

std::cout << '\n' << std::endl;

}

}

User Avatar

Wiki User

8y ago

What else can I help you with?

Related Questions

What are the number of wavelengths that pass a position in 1 second.?

The number of wavelengths that pass a position in 1 second is equivalent to the frequency of the wave in hertz. This is because frequency represents the number of oscillations or cycles of the wave per second.


What is the instrument used for measuring frequency?

An oscilloscope is commonly used to measure frequency by displaying the waveform of the signal and showing the number of cycles per second. Other instruments like frequency counters or spectrum analyzers can also be used to measure frequency accurately.


What type of graph is best suited for displaying the range and frequency distribution of the number of apples sold at a produce stand while still showing the number of apples bought by individual cust?

stem-and-leaf plot


What is amplitude and frequency of a wave?

The amplitude is the maximum displacement. The frequency is the number of peaks (or troughs) that occur in unit time (usually a second).


How do you program a regency act t16k?

Press the channel number you want to program, then press, pr, now inter the frequency. then press channel number again. Good luck Bill Rusher warusher@ftc-i.net


How will frequency change if you double the amplitude?

Doubling the amplitude of a wave will not change its frequency. Frequency is determined by the number of complete oscillations a wave makes in a given time period, while amplitude refers to the maximum displacement of particles from their rest position.


Is ampiltude the number of waves per unit of time?

No, amplitude is the maximum displacement of a wave from its equilibrium position. The number of waves per unit of time is the frequency of the wave.


Does changing the frequency change the amplitude?

No, changing the frequency of a wave does not change its amplitude. Amplitude is a measure of the maximum displacement from the equilibrium position, while frequency is the number of oscillations per unit time. These two properties are independent of each other.


Does velocity equal frequency?

No, velocity and frequency are different physical quantities. Velocity is the rate of change of position with respect to time, while frequency is the number of occurrences of a repeating event per unit of time. In some cases, they may be related through the wavelength of a wave, but they are not equivalent.


How do you program Z 45 regency scanner?

To program the Regency Z30 TURN UNIT "ON" 1. Press "MANUAL" 2. Enter the frequency you want, example 162.475 3. Press "ENTER" The display will show "Ch_" with the _ (underscore) flashing 4. Enter the number of the channel where you wish to store the frequency. Note: channels 1 thru 9 must have a zero before them, example 01, 02,........ 09 If you want to add more frequencies at this time, got to step 2. To lock out a channel, press "SCAN" and while the unit is scanning,enter the channel number. Repeat this action to unlock a channel. To increase or decrease the scanning rate, press the "SPEED / ENTER" key while the unit is scanning. To create a delay after a transmission, press the "DELAY" key while the unit is scanning. You can change the display by pressing the "CHANNEL / DISPLAY" key. There are 3 choices: display only the channel number, only the frequency,or alternate displaying the channel number and the frequency.


The number of times a data occurs?

the answer is frequency. the answer is frequency.


What is the best graph to make show the density of a number of different substance is?

A histogram is a suitable graph to show the density of different substances, as it can visually represent the distribution and frequency of data points. By binning the data into intervals and displaying the frequency of each interval, you can effectively showcase the density differences among the substances in a single visual representation.