C++

Write a program that reads in at most 100 integers that are between 1 and 100 and counts the occurrence of each number in the list. Assume the list ends when a zero is inputted.

Answers

Answer 1

Answer:

#include <iostream>

#include <map>  

using namespace std;

int main()

{

   map<int, int> numbers;

   cout << "Enter numbers, 0 to finish" << endl;

   int number;

   while (true) {

       cin >> number;

       if (number == 0) break;

       numbers[number]++;

   }

   for (pair<int, int> element : numbers) {

       std::cout << element.first << ": occurs " << element.second << " times" << std::endl;

   }

}

Explanation:

One trick used here is not to keep track of the numbers themselves (since that is not a requirement), but start counting their occurrances right away. An STL map< > is a more suitable construct than a vector< >.


Related Questions

Consider the following Java program. Describe what it does in response to specific operations of the mouse, and how it does it. (You are encouraged to run the program for yourself to test its behavior. Then read through the program carefully to understand how that behavior arises.)
import java.awt.event.*;
import javax.swing.*;
public class MouseWhisperer extends JFrame implements MouseListener {
MouseWhisperer() {
super("COME CLOSER");
setSize(300,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addMouseListener(this);
setVisible(true);
}
public void mouseClicked(MouseEvent e) { setTitle("OUCH"); }
public void mousePressed(MouseEvent e) { setTitle("LET GO"); }
public void mouseReleased(MouseEvent e) { setTitle("WHEW"); }
public void mouseEntered(MouseEvent e) { setTitle("I SEE YOU"); }
public void mouseExited(MouseEvent e) { setTitle("COME CLOSER"); }
public static void main(String[] args) { new MouseWhisperer(); }
}

Answers

Answer:

Explanation:

This java code creates a windowed java application that is 300x100 pixels large. The title of the program which is located in the bar at the top of the program starts off by saying "Come Closer". If you move the mouse over the program the program detects it. Then if you press the program it changes the title to "Let Go". If you press the program and immediately let go it changes the title to "Ouch" but if you hold for 1 or 2 seconds and let go it changes the title to "Whew". Finally, if you move the mouse cursor away from the program it changes the title back to "Come Closer"

A specific packet journey, from your computer to a remote server, end-to-end across multiple networks, has the following link bandwidths (packet travels across each of these links, in order): 1000 Mbps, 1 Mbps, 40 Mbps, 400 Mbps, 100 Mbps, 1000 Mbps. Assuming your computer and the server can transfer data at > = 1000 Mbps (so neither device is limiting the data transfer relative to the links), how long, in seconds, will it take to transfer a 125 MB file?

Answers

Answer:

0.125 seconds

Explanation:

The formula for the time taken to transfer the file is = file size / bandwidth

Assuming the computer and server could only transfer data at the speed of 1000 Mbps or more, The time of transmission is;

= 125 MB / 1000 Mbps = 0.125 seconds.

Write a recursive function named double_digits that accepts an integer as a parameter and returns the integer obtained by replacing every digit with two of that digit. For example, double_digits(348) should return 334488. The call double_digits(0) should return 0. Calling your function on a negative number should return the negation of calling it on the corresponding positive number; for example, double_digits(-789) should return -778899.

Answers

Answer:

A recursive function known as double-digit is a function that accepts as a parameter and returns the integer that is obtained by changing each digit with double digits. For example 425 should be return as 442255.

In the given scenario

the function will be as follow

If

def double_digits:

n < 0:

return -1 * double_digits ( -1 * n )

elif n = 0

return o

else:

result

double_digits ( n // 10 )

return int ( str ( result ) + str ( n % 10 ) + str ( n % 10 )

Test the function as follow

print ( double_digits ( 348 ) )

Result

334488

Test the function as follow

print ( double_digits ( 0 ) )

Result

0

Test the function as follow

print ( double_digits ( -789 ) )

Result

-778899

Writea SELECT statement that uses the ranking functions to rank products by the total quantity sold. Returnthese columns:The product_name column from the Products tableA column named total_quantity that shows the sum of the quantity for each product in theOrder_Items tableA column named rank that uses the RANK function to rank the total quantity in descending sequenceA column named dense_rank that uses the DENSE_RANK function to rank the total quantity in descending sequence

Answers

Answer:

SELECT  product_name, SUM(DISTINCT quantity) AS total_quantity

RANK() OVER (PARTITION BY total_quantity ORDER BY product_name) AS rank,

DENSE_RANK () OVER (ORDER BY quantity DESC) AS dense_rank

FROM Order_items

JOIN products ON Order_items.product_id = products.product_id

GROUP BY product_id

Explanation:

The SQL query returns four columns namely, product name, total quantity, rank and dense rank. The query uses the rank and the dense rank function to return the rows according to numeric ranks.

describe an activity to prove that sounds can travel in a liquid medium
in long



Answers

An activity to prove that sounds can travel in a liquid medium in long​ time is:

Use a tub  that is filled with water, also take a bell in one of your hand and then one can dip it into the water.  Note that you need to Keep one of your ears close to the surface of water and do not let the water go into the ear. Then ring the bell inside the tub water. You will be able to hear the sound very clearly. This tells that sound can travel via liquids.

How do sounds travel in liquids?

Sound waves is known to be one that tends to travel a lot faster in denser forms or kinds of substances due to the fact that neighboring particles will be able to bump into each other.

Therefore, An activity to prove that sounds can travel in a liquid medium in long​ time is:

Use a tub  that is filled with water, also take a bell in one of your hand and then one can dip it into the water.  Note that you need to Keep one of your ears close to the surface of water and do not let the water go into the ear. Then ring the bell inside the tub water. You will be able to hear the sound very clearly. This tells that sound can travel via liquids.

Learn more about sounds from

https://brainly.com/question/1199084

#SPJ1

CPU is an abbbreviation for
1.Central processing unit
2.Computer processing unit
3.Control processing unit

Answers

Answer:

1.Central processing unit

Explanation:

CPU is an abbreviation for Central processing unit.

The system where the unit of measurement is centimeter

Answers

Answer:

International System of Units

Explanation:

what is the purpose of writing a topic sentence​

Answers

Answer:

A topic sentence must highlight the main idea of a paragraph, letting the reader know what the paragraph will be about. The topic sentence must present an idea that will unify the rest of the paragraph while relating it back to the main thesis of the paper.

Explanation:

Answer:

To summarize the main point of paragraph

Explanation:

what stage is the most inner part of the web architecture where data such as, customer names, address, account numbers, and credit card info is the store?

Answers

Never store the card-validation code or value (three- or four-digit number printed on the front or back of a payment card used to validate card-not-present transactions). Never store the personal identification number (PIN) or PIN Block. Be sure to mask PAN whenever it is displayed.

how ssd is better than normal sata and pata HDD​

Answers


The HDD offers high storage capacities at a low price, while the SSD provides blazing fast access speeds at a higher cost.

Before we can use the PS Session to remotely manage a target system, there are certain tasks we must perform, such as create exception in Firewall and enable WinRM. PowerShell has a cmdlet that can perform all of these tasks at once.
A. Start-PSRemoting.B. Enable-PSRemoting.C. Enable-PSSession.D. Get-PSRemoting.

Answers

Answer:

B. Enable-PSRemoting.

Explanation:

Powershell is a command-line interface software used in windows operating system to manage the operations of the system. It is similar to the bash terminal scripting language in Linux and has some of the command prompt features.

The PS session is used to manage remote systems connected wirelessly to the administrative system. The command used to enable this process is "Enable-PSRemoting".

Please help this computer science question(Pseudocode and Trace table)

Answers

Answer:

can u explain more specific plz

Explanation:

If you are working on doing senior portraits and want a lens that will give you the best shallow depth of field which lens would you choose?
a) 55mm f1.2 (focal length of 55mm, maximum aperture of 1.2)
b) 28-80mm f4.5 (Zoom lens with focal length from 28-80mm, max aperture 4.5)
c) 18mm f5.6
d) 50mm f1.4
45 points and brainliest

Answers

Answer: The answer is C     Hope this helps :)    Please mark Brainliest

Explanation:

Answer:

c) 18mm f5.6

Explanation:

For the best lens that offers the best shallow depth of field, you need to choose the one with the maximum apertature but does not zoom.

Hence choice c) has the maximum aperture and does not zoom.

Hope this helps :)

Why do people want phones so bad??

Answers

To help explain this, take a look at these reasons why kids should have cell phones:

#1 To keep in touch. What happens if you're running late picking your child up from school? ...

#2 To talk to friends. ...

#3 To stay safe. ...

#4 To develop essential skills. ...

#8 To improve their organization. ...

#11 To encourage responsibility.

Because we live in a world full of technology and we use it for almost everything. They made life easier in some ways

Biodiversity explanation

Answers

the variety of life in the world or in a particular habitat or ecosystem

Organize the steps involved in the colorization of an old black-and-white photo.

Use dodge, burn, and noise tools.
Restore the old photo.
Adjust the RGB (or CMYK) ratio.
Select the desired area.

Answers

Answer:

How to recolor black and white photos?

Learn how to colorize black and white photos in only 4 minutes

Cleaning the image. When you open the image in Photoshop, convert it to Smart Object and start by removing the scratches and dust. ...

Adjusting the image tones and contrast. If you're working with a sepia image, add a Black & White adjustment layer to neutralize the tones. ...

Converting the image to CMYK. ...

Adding color.

Explanation:

Answer:

1) restore the old photo

2) select the desired area

3) Adjust the RGB (or CMYK) ratio

4) Use dodge, burn, and noise tools

Explanation: correct on Edmentum

what type of collection is used in the assignment statement
info: [3:10,4:23,7:10,11:31]

tuple
list
Duque
dictionary ​

Answers

Answer:

The correct answer to this question is given below in the explanation section.          

Explanation:

There are four data types in Python used to store data such as tuple, list, set, and dictionary.

The correct answer to this question is option D: Dictionary

Dictionary data type is used to store data values in key:value pairs as given in the question. It is a collection that is changeable, unordered, and does not allow duplicate entries.

Dictionaries in Python are written with curly brackets and have keys and values such as car={name="honda", model=2010}

when you run the given assignment statment such

info= {3:10,4:23,7:10,11:31}

print(info)

It will print the info dictionary (key:value pair)

{3: 10, 4: 23, 7: 10, 11: 31}

While other options are not correct because:

Tuples in Python are used to store multiple items in a single variable. For example:

info=("apple", "banana", "cherry")

List is used to store multiple items in a single variable. for example

myList = ["apple", "banana", "cherry"]

print(myList)

The list is ordered, changeable, and allows duplicate entry. But you can not put key: value pair in the list.

Deque is a double-ended queue that has the feature to add or remove an element on it either side.

Answer:

Dictionary is the answer

Please help with this

Answers

Answer:

Horizontal lines chart/graph

I'm in Paris and want to take a picture of my mom in front of the Eifel Tower. I want both her and the tower to be in sharp focus. Which aperture is likely to do the best job of giving me that deep depth of field?
a) 2
b) 5.6
c) 11
d) 22
50 Points and brainliest mark

Answers

Answer:

Explanation:

It depends on the day. 5.6 might be best if it is a cloudy day. 2 would not work under any conditions.

11 might work well on a hazy day, but the sun is sort of visible.

A nice clear sunny day would allow you to use 22.

Answer:

Generally, a small aperture like f/8 will give you enough depth of field to be able to make most of your image sharp. However, if the subject is too close to your camera, you might need to either move back or stop down the lens even further to get everything looking sharp

And mostly :

It depends on the day. 5.6 might be best if it is a cloudy day. 2 would not work under any conditions. 11 might work well on a hazy day, but the sun is sort of visible. A nice clear sunny day would allow you to use 22.

Denise is using Outlook 2016 in a business environment. Her company operates a Microsoft Exchange email server.

When Denise uses the address book, which tool is she using by default?

Offline Address Book
Personal Address Book
Global Address List
Custom Address List

Answers

Answer:

Custom Address link

Explanation:

Answer:

D custom address list

Explanation:

Edge 202

You manage a Windows server that has an attached printer that is used by the Sales department. The sales manager has asked you to restrict access to the printer as follows:Sally needs to connect to a printer, print documents, and pause and resume her own print jobs.Damien needs to pause and resume documents for all users, but does not need to change printer properties.You want to assign the most restrictive permissions that meet the sales manager's requirements. What should you do

Answers

Answer:

Damien would be assign the Manage Documents permission while Sally on the other hand will be assign the permission to print.

Explanation:

Based on the information given in order for me to assign a restrictive permission that will meet the requirements of the sale manager's what I will do is for me to assign the Manage Documents permission to Damien reason been that Damien only needs to stop and resume the documents for all users in which he does not need to change the printer properties and to assign the permission to print to Sally reason been that Sally only needs to connect to a printer and to print documents in which she will then stop and resume her own print jobs.

Mary is writing an article about the animal kingdom. She wants to place an image below the text. Which menu should Mary choose for this
purpose?
Mary needs to choose the _________
menu in order to place the text in a desired fashion around the image

Plato btw

Answers

Answer:

she needs to choose the insert menu


If you wanted readers to know a document was confidential, you could include a ____ behind the text stating
"confidential".
watermark
theme
text effect
page color

Answers

I have no idea for that

Answer:

watermark

Explanation:

Jorge is sending a message to Thomas but would like a copy sent to his external email address as well. Jorge does not want Thomas to see this copy that was sent.

Which mail field will Jorge use to achieve this goal?

To:
From:
CC:
BCC:

Answers

Answer:  BCC (fourth choice)

=================================================

Explanation:

CC stands for "carbon copy".

BCC stands for "blind carbon copy".

Filling out forms is a tedious process. It's even more tedious when you have to repeat yourself multiple times. Carbon copy paper technology allows you to fill out one form and have those inputted entries be copied to the layers below. In terms of email, a carbon copy (CC) email is just an email sent to more than one person. In the CC line, recipients can see who the other people are in the email chain.

In contrast, a blind carbon copy is where the recipients cannot see who is in the BCC line. This allows Jorge to send the message copy to an external address without Thomas knowing.

What is the thickness of a character’s outline called

Answers

Answer:

actually is answer is font weight

hope it helped!

One of the following is NOT a basic linked list operation:_________.
a) search
b) insert
c) create
d) delete
e) traverse
f) destroy
g) build list from file

Answers

Answer:

One of the following is NOT a basic linked list operation:_________.

g) build list from file

Explanation:

Linked list operation is the creation of trees and graphs or a chain of data elements, which are called nodes.  Each note points to the next using a pointer.  In linked lists, each node consists of its own data and the address of the next node.  A linked list, which may be single, double, or circular, forms a chain-like structure that builds from one node to the other.

how to earn money fast in adopt me?

Answers

Become a baby and take care of yourself and pets

Answer:                                                                                                                        If you want money in adopt me quickly, you could become a baby and buy a pet and take care of it and yourself. Also, you could purchase adopt me bucks with robux.

Explanation:

Adam is so good at playing arcade games that he will win at every game he plays. One fine day as he was walking on the street, he discovers an arcade store that pays real cash for every game that the player wins - however, the store will only pay out once per game. The store has some games for which they will pay winners, and each game has its own completion time and payout rate. Thrilled at the prospect of earning money for his talent, Adam walked into the store only to realize that the store closes in 2 hours (exactly 120 minutes). Knowing that he cannot play all the games in that time, he decides to pick the games that maximize his earnings
Sample game board at the arcade GAME COMPLETION TIME (in minutes) PAYOUT RATE Pac-man 90 400 Mortal Kombat 10 30 Super Tetris 25 100 Pump it Up 10 40 Street Fighter II 90 450 Speed Racer 10 40
An acceptable solution is the one where it still picks the best earnings even when the list of games or completion times or payout rates change.
Question:
Write code in Java/Scala/Python to help Adam pick the sequence(s) of games that earn him the most money?.
Then, assume you have a variable list of games and their payout rates. What is the best way to pick the games that earn you the most?
Input Explanation
The first line of input is always an integer denoting many lines to read after the first line. In our sample test case, we have 6 in the first line and 6 lines after the first line, each having a game, completion_time and payout_rate.
In each data line, the game, completion_time and payout_rate are separated by a ','(comma).
The games board may change but the store still closes in 120 minutes.
Input
6
Pac-man,80,400
Mortal Kombat,10,30
Super Tetris,25,100
Pump it Up,10,40
Street Fighter II,90,450
Speed Racer,10,40
Output Explanation
Print the game names that earn him the most into the standard output in alphabetical order
Output
Mortal Kombat
Pump it Up
Speed Racer
Street Fighter II

Answers

Answer:

ask it to ur teacher boiiiiii

Which of the following scenarios is most likely to give you the shallowest depth of field?
a) 18mm lens at f5.6, subject 20 feet away.
b) 50mm lens at f22, subject 6 feet away.
c) 28mm lens at f4, subject 15 feet away.
d) 85mm lens at f2, subject 8 feet away
50 points and brainliest

Answers

Answer: The answer is B    Hope this helps :)   Please mark Brainliest

Explanation:

Which contact field is used to control the name that would appear in the To field of an email message when a user is sending a message to a contact?

Display As
File As
Save As
Full Name

Answers

Answer:

Display as

Explanation:

Need the same question, but that's my guess, because display, means to show.

Answer: file as

Explanation:

correct on edg 2021

Other Questions
help please thanks This is for Science What is the perimeter of the parallelogram?29 cm80 cm58 cm32 cm 2 the filament in an electric light bulb is made from a. platinum b. fiberglass c. aluminum d. tungsten an activist is protesting against his goverment .he is angry that the goverment is controlled by a king who inherited his power from his father. the activist demands that the citizens be given the right to select their leaders. which idea does the activist support PLZ HELP! I WILL GIVE BRAINLIEST FOR PERSON WHO ANSWERS CORRECTLY! DO NOT ANSWER IF U DON'T KNOW THE ANSWER!InstructionsFor this project, you'll write a set of technical directions or a how-to text. Write a set of step-by-step instructions about any of the following or an alternative accepted by your teacher.ReminderDo not forget:All elements of a set of directions or how-to manual are included with the goal of explaining to the reader how to complete the process. Remember to use headings, bullets, etc. so that your reader can quickly navigate the text.recipecomplex process (e.g., wrapping a gift, changing the oil in a car, etc.bylaws for a club or organizationYou will be graded on the proper use of a title, headings, bullets, numbering, graphics and special fonts (italics, bold, etc.). You must include a list of ingredients or tools needed to complete your project.Here is a sample project.How to Build a SnowmanBuild a classic snowman with these directions.Materials Neededplenty of snowtwo sticks (for the arms)1 carrot (for the nose)8-10 rocks or coal pieces (for the eyes and mouth)scarf, hat and other accessories (optional)InstructionsStep 1: Make three fist-sized snowballsStep 2: Roll the first snowball in the snow, adding to its volume until it's the size of a large beach ball.Step 3: Place this ball on the ground. It is the base of your snowman.Step 4: Take the next snowball and roll it in the snow until it is about half the size of the first ball (maybe about the size of a large watermelon).Step 5: Place the second ball on top of the first one.Step 6: Take the third ball and roll it in the snow until it is about the size of a basketball.Step 7: Place the third ball on top of the other two. This is your snowman's head.Step 8: Poke the sticks in the sides of the snowman for arms, arrange the rocks or coal on the snowman's face to create his eyes and mouth and add the carrot for his nose.Step 9: If desired, decorate your snowman with a scarf, hat or other accessory.Tips & WarningsDon't make the second ball too heavy (or be sure you have a friend to help you lift it) because it may breakYou can be as creative as you'd like with sticks, rocks, and other items.You can also use more snow to create animals by adding different kinds of ears to this basic snowman. how is wind energy captured?where is wind energy found?how is water energy captured?where is water energy found?plz use the passage i put. plz and thank you!!!!! PLZ HELP I REALLY NEED HELPstate whether the relationship between x and y in y + 4x-5 is proportional or non-proportional. then graph the function Frolic Corporation has budgeted sales and production over the next quarter as follows: August September Sales in units Production in units July 50,000 71,200 62,000 62,300 66,650 The company has 6000 units of product on hand at July 1. 10% of the next month's sales in units should be on hand at the end of each month. October sales are expected to be 81,500 units. Budgeted sales for September would be (in units):__________. A) 74,800 B) 65,000 C) 74,000 D) 72,850 Pierce is planning his essay on the best careers for the future. He has developed a list of important ques consider Which item is LEAST LIKELY to be on that list? A) What is the salary for this job?B.What benefits or perks come with this position?C. Is the application process for this career available online?D) How likely is career advancement or promotions in this field? A double-slit interference pattern is created by two narrow slits spaced 0.21 mm apart. The distance between the first and the fifth minimum on a screen 61 cm behind the slits is 6.2 mm What is the wavelength of the light used in this experiment? PLZ HELP THANK YOU! How would you refer to a married couple?nietospadresabuelosespososhijos Please answer correctly !!!!!!!!!!!!! Will mark Brianliest pleaseeeee !!!!!! worth 50 pointsEach of the following groups of statements includes one main idea and three supporting details.A. There were ten women in the House of Representatives in 1970 and only one woman in the Senate.B. In North Carolina, only a virgin could charge a man with criminals.C. Divorce women were regarded as high risks by insurance companies, and they had trouble getting credit cards.D. In the early 1970s, women still had a long way to go in terms of gaining equal rights Help please didnt mean to press that one! write the name of any 2 organization working in nepal to control corruption ? What value of w makes the equation 145 = w + 27 true? Native Americans taught the Pilgrims to modify the environment and grow better crops by-O A using dead fish as fertilizer to improve the soilOB. digging holes in the dirt with their fingers to add airO C. cutting down a tree and planting corn next to the stumpO D. planting the corn and compacting the soil around the seed 1. Consider the following system of linear equations.15y =5x+y4 53*-3y = 32Part A: What property/properties can be used to write an equivalentsystem? A hybrid SUV gets 32miles per gallon on the highway driving at a constant 55 miles per hour.At this rate, how many gallons per hour does the hybrid SUV use? On May 10, 2020, Cullumber Co. enters into a contract to deliver a product to Greig Inc. on June 15, 2020. Greig agrees to pay the full contract price of $1,810 on July 15, 2020. The cost of the goods is $1,050. Cullumber delivers the product to Greig on June 15, 2020, and receives payment on July 15, 2020. Prepare the journal entries for Cullumber related to this contract. Either party may terminate the contract without compensation until one of the parties performs.