Create a program to determine the largest and smallest number out of 15 numbers entered (numbers entered one at a time). This should be done in a function using this prototype: double larger (double x, double y); Make sure you use a for loop expression inside your function. Enter 15 numbers 11 67 99 2 2 6 8 9 25 67 7 55 27 1 1 The largest number is 99

Answers

Answer 1

Answer:

#include <iostream>

using namespace std;

double larger( double x, double y){

   if (x > y){

       return x;

   } else{

       return y;

   }

}

int main(){

   int n, max = 0;

   for (int i =0; i < 15; i++){

       cout<< "Enter item"<< i+1 << ": ";

       cin>> n;

       cout<< "\n";

       max = larger( n, max);

   }

   cout<<"The maximum number is: "<< max;

   return 0;

}

Explanation:

The C++ program defines the function 'larger' that compares and returns the largest of two numbers. The main program prompts the user for 15 numbers and the larger function is called to return the largest of the fifteen numbers given.


Related Questions

Which tool adds different amazing effects to a picture.

(a) Paint

(b) Lines tool

(c) Magic tool​

Answers

Answer:

magic tool

Explanation:

For which of the seven steps to solve a programming problem is the scientific method most useful?

Answers

Answer:

the planning stage

Explanation:

The scientific method would be most useful during the planning stage of solving a programming problem. This is because during this stage you are thinking of what the problem is and what are the possible solutions that may work. The scientific method is made to help scientists do just that, understand what the problem is, design a possible solution from a hypothesis and design a way to implement or test that solution. Which is the most important piece of solving a programming problem (designing a solution)

The Publisher-Subscriber design pattern is used to create __________________ communication between software objects and is used to build _____________ components.

Answers

Answer:

indirect, reusable

Explanation:

The Publisher-Subscriber design pattern is used to create indirect communication between software objects and is used to build reusable components.

Sonja is writing a program to compare two numbers and print the larger number. Which of these should be used?
a while loop
if and else
if, elif, and else
a string variable

Answers

Answer:

if and else

Explanation:

if (num1 > num2):

   print(num1)

else:

   print(num2)

ChodeHS Exercise 4.3.5: Coin Flips

Write a program to simulate flipping 100 coins. Print out the result of every flip (either Heads or Tails).


At the end of the program, print out how many heads you flipped, how many tails you flipped, what percentage were heads, and what percentage were tails.

Answers

Answer:

public class CoinFlips extends ConsoleProgram

{

   public static final int FLIPS = 100;

   

   public void run()

   {

       int countH = 0;

       int countT = 0;

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

       {

           if (Randomizer.nextBoolean())

           {

               System.out.println("Heads");

               countH += 1;

           }

           else

           {

               System.out.println("Tails");

               countT += 1;

           }

       }

       System.out.println("Heads: " + countH);

       System.out.println("Tails: " + countT);

       System.out.println("% Heads: " + (double) countH / FLIPS);

       System.out.println("% Tails: " + (double) countT / FLIPS);

   }

}

Explanation:

First define your counting variables for both heads and tails (I named them countH and countT). Set them to 0 at the start of the run.

Then use a for loop to flip the coin 100 times. In the video you should have learned about the Randomizer class so you can use the same idea to print out whether you got heads or tails.

Make sure to keep the count going using >variable name< += 1.

The printing at the end is very basic; print the statement for each: ("Heads: " + >variable name<);

For the percentages, print ("% Heads: " + (double) >variable name< / FLIPS); divided by FLIPS (not 100 or any other int because you will get the wrong value) and remember to cast them as doubles to get the correct value.

The program simulates 100 coin flips and displays the result of each flip and the resulting percentage. The program written in python 3 goes thus :

import random

#import the random module

total = 0

#initialize the total coin flips

h_count = 0

t_count = 0

#initialize variable to hold the number of heads and tails

h_t = ['h', 't']

#define the sample space

while total < 100 :

#keeps track that tosses does not exceed 100

toss = random.sample(h_t, 1)

#variable to hold the outcome of each coin toss

if toss[0] == 'h':

#heck if toss is head

h_count+=1

Increase count of heads. owee

print(toss[0], end=' ')

#display the sample selected

else:

#if not head, then it's tail

t_count+=1

#increase count yv

print(toss[0], end=' ')

total+=1

#

print('head counts : ', h_count, 'percentage : ', round(h_count/100, 2),'%')

print('tail counts : ', t_count, 'percentage : ', round(t_count/100, 2), '%')

# display result.

A sample run of the program is attached

Learn more: https://brainly.com/question/18581972

Name and define two ways an IDS connects to a network.

Answers

Answer:

The two ways an IDS connects to a network are:

1. Signature-based detection uses patterns by establishing a unique identifier for the detection of future cyber attacks, using the IDS sensors and consoles.

2. Statistical anomaly-based detection, as an expert system, relies on the identification of anomalies in the network traffic by comparing against established baselines.

Explanation:

Organizations use the Intrusion Detection System (IDS) as a software program to detect a computer network attack in an effort to stop the attack.  The program analyzes the network traffic for signatures of known cyberattacks and the delivery of network packets.  There are two types: NIDS and HIDS.  Whereas a Network Intrusion Detection System (NIDS) is designed to support multiple hosts, a Host Intrusion Detection System (HIDS) is set up to detect illegal cyber actions in a host's operating system files.

How do I retrieve the number from an old home phone? Someone called my home phone (it is not a cellular phone) and they did not leave their phone number. Any advice welcome.

Answers

Answer: Use recent Callers function

Explanation:

Now all home phones have different ways of getting there, but should you see a settings, or functions button, or even a button that looks out of place in the middle of the phone right underneath the screen, that is the button that you will select. Go through the options available and you will see a option called "Recent Callers" and there you will be able to find all the recent callers whom called your home phone.

Which utility is used to transform a standalone Windows Server 2012 R2 system into an Active Directory domain controller?

Answers

Answer:

The utility that is used to transform a standalone Windows Server 2012 R2 system into an Active Directory domain controller is called:

PowerShell Command Line 6.

Explanation:

An Active Directory Domain Controller is the box that holds the keys to the Active Directory, centrally managing the access for users, PCs, and servers on the network.  It responds to the authentication requests and verifies the users on computer networks.  The Active Directory is the database that organizes the company's users and computers.

It is important to know the terms of use of any website because why

Answers

They may be selling your information. For example have you ever seen a icon that said accept cookies.. that is a type of term you must agree on to enter certain websites.
They could sell your information or HAC you

Which of the following is true of operations within a spreadsheet program’s built-in functions?
Operations within parentheses, then multiplication and division, and then addition and subtraction are computed.
Operations within parentheses, then addition and subtraction, and then multiplication and division are computed.
Multiplication and division, then addition and subtraction, and then operations within parentheses are computed.
Addition and subtraction, then multiplication and division, and then operations within parentheses are computed

A. Operations within parentheses, then multiplication and division, and then addition and subtraction are computed.

Answers

Answer:

a is the answer

Explanation:

I get brainlist to whoever can help my computer is doing this and I have class and it’s not working and I got it wet yesterday but it was fine in homeroom help please

Answers

Answer:

try putting a lot of rice on the screen.

Explanation:

if it got water in it that should help it.

did u try rice? how about turning it off and back on again?


Victor has an Excel workbook that contains a macro. What is the appropriate file type to save the workbook in?
xlsx
xitx
xlsm
xlx

Answers

Answer:

xlsm

Explanation:

Generally, workbooks are known as Microsoft Excel files. Excel workbook can be defined as a collection of one or more charts and worksheets (spreadsheets) used for data entry and storage in an excel file. In order to create a project on Excel you will have to use a workbook.

A spreadsheet can be defined as a file or document which comprises of cells in a tabulated format (rows and columns) typically used for formatting, arranging, analyzing, storing, calculating and sorting data on computer software applications such as Microsoft Excel.

The Microsoft developers has made it easy for their users to automate the tasks used frequently through the creation and execution of macros.

Basically, macros comprises of commands and instructions which may be grouped together as a single command to automatically execute a task.

In this scenario, Victor has an Excel workbook that contains a macro. Thus, the appropriate file type to save the workbook in is the xlsm extension (format).

Advanced Search forms make it easier for you to _____. Select all that apply. A. find webpages published within a certain time frame B. search a specific website C. search your computer D. find webpages written in a specific language

Answers

Answer:

The correct answers are A, B and D. Advanced Search forms make it easier for you to find webpages published within a certain time frame, search a specific website and find webpages written in a specific language.

Explanation:

Advanced Search is called the specific search filters that the different internet search engines have, such as Goo.gle or Yah.oo, by means of which parameters can be established within which the search engine will collect information in a more precise way for the user. Thus, the user selects temporal, territorial, idiomatic parameters, etc., on which to focus their search, obtaining more specific results than those that a generic search would yield.

Advanced search forms make it easier to find webpages published within a certain time frame, search a specific website, and find webpages written in a specific language (Options A, B and D).

Advanced search forms enable the generation of search queries by employing specific content fields and/or segments.

The advanced search forms are useful to search any type of specific information in an easy user-friendly manner.

This type of search (advanced search) can be used to customize and filter search results in a dynamic manner, including a given period of time, different languages, etc.

In conclusion, advanced search forms make it easier to find webpages published within a certain time frame, search a specific website, and find webpages written in a specific language (Options A, B and D).

Learn more in:

https://brainly.com/question/3198358

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

Answers

Answer:

line = sys.stdin.readline()

print(line)

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

Python:

import sys

line = sys.stdin.readline()

print(line)

pls help ...
Consider the code given below:
public class Testone {
public static void main (String[] args) throws Exception {
Thread.sleep (3000);
System.out.println("sleep");
}
)
What is the result?
Select one:
a. The code executes normally and prints "sleep".
b. The code executes normally, but nothing is printed.
a
C. A RuntimeException is thrown at runtime
d. Compilation fails
e. An exception is thrown at runtime.
Next pag​

Answers

Answer:

You open the class, and print sleep after thread 3000So A

7) Which of the following is False regarding RISC and CISC architectures?
a) CISC has variable length instruction formats while RISC has fixed length instructions. b) CISC has a larger number of instructions than RISC.
c) CISC has more addressing modes than RISC.
d) In RISC, memory access is limited to load and store instructions, while in CISC, other instructions can support memory access.
e) CISC has a larger number of general purpose registers than RISC.

Answers

D hope that helps
Have a. Good one

Which of these is a super class of wrappers Double & Integer?
a. Long
b. Digits
c. Float
d. Number

Answers

A I’d believe sorry if it wrong

What is the output of the code?
public class trackList
public static void main(StringD args)
ArrayList track new ArrayListcinteger)
track.add(45);
track.add(55);
track.add(85);
System.out.print(track);
runtime error
45
55
85
compiler error

Answers

Answer:

45, 55, and 85

Explanation:

The Java program is complete and logically correct. It creates and adds integer values to an array list. The 'System.out.print' function of the track array variable would not throw any error but output the list of integer values.

When is historical data not useful

Answers

Answer:

to address for setting cost increase of a resource to determine the amount of money needed for a future project to plan for future years operation costs to predict sales based on past growth

Which line of code will display the variable rounded to the nearest tenth?
print(num, round)
print(round(num, 1))
print(num rounded)
print(round(num,.1))

Answers

Answer:

print(round(num, 1))

Answer:

D

Explanation:

Chief technology officers can influence a company's current and future ____.

Answers

Answer: developments is my best guess

Explanation:

Why is it important in manufacturing to determine allowances? How do allowances relate to tolerance dimensioning?​

Answers

Answer:

Sry I can’t really help you with this one

Explanation:

What do presentations in spreadsheet software have in common??

A. Both analyze numeric data
B. Both calculate numeric formulas
C. Both convey numeric and/or text data
D. Both illustrate 


Hurry plzzz first person gets brainiest

Answers

Answer:

C both convey numeric and text data.

Explanation:

It's the most likely answer.

C) hope this helps out


1. Avoid unnecessary sliding of T-square or triangles across the drawing

Answers

Answer:

The answer is "True".

Explanation:

It is vertical or ambiguous districts are called a triangle. It typically comes in different sizes but is made of photographic film or plastic. Its triangles more widely shown are 45 grades and 30 grades were x 60. The following illustrations illustrate their correct use of T-square or triangle graph lines. The T-Place a designing tool, which is used to draw horizontal and vertical lines.

What is the purpose of creating folders in a file structure????
A. To store more than 256
location
B. To allow windows naming to be applied
C. To secure files
D. To store thousand organized way

Hurry I need help plzzzz!!!

Answers

Answer:

D

Explanation:

everything is about organised it's about how you store your things to find them faster when you need them

5. Describe the concept behind a digital signature and explain how it relates to cybersecurity by providing a hypothetical example of a situation in which a digital signature could enhance cybersecurity

Answers

Answer:

Could help when two doctors have to approve a patients treatment, or when two workers of the same company are working on classified information.

Explanation:

A digital signature creates a stamp on a document, that has time, location and is used to assure that the right person was the one that signed off the document and that no one changed the message or the content of the document between the signer and the receiver.

This helps in providing security and a legal frame to digital documents.

A message with 3000 bytes gets encoded using the scheme Base64. What will be the size of the encoded message?

Answers

Answer:

4000 characters

Explanation:

Base64 encodes each set of three bytes into four bytes.

So 3000 * 4/3 = 4000 characters.

What is the value in y2 when the code show below executes?
x1 = [ 5 3 1 7 9]; [y1 y2] = min(x1)

Answers

Answer:

y2 = 3

Explanation:

This question needs us to give the value of y2 when we run this code in the question.

By min(X1) it is asking for the minimum value in the list of values that we have in the question.

Y1 is the first minimum value in the list and it is = 1

Our answer of interest in this solution is to, which is the second minimum value in the list after Y1

Therefore y2 = 3

Thank you!

Write a procedure that takes a positive integer as a parameter. If the number given to the procedure is no more than 30, the procedure should return the absolute difference between that number and 30. If the number is greater than 30, the procedure should return the number doubled.

Answers

Answer:

The following code is written in C++

#include<iostream.h>

int main()

{

int n;

cin>>" Enter Number>>n;

if(n < 30)

      {

            cout<<"Absolute Difference is 30";

      }

else

       {

             cout<<"Absolute Difference is "<< 2*n;

       }

return 0;

}

From the demonstration video on navigating the Outlook interface, which of the following is true? Check all that apply.

Use the ALT key on the keyboard to toggle letter keys to activate functions in Outlook.
To get to the Backstage view, click on the File tab on the top left.
The Outlook icon can be found on the Task Bar in Windows by default.
The Message Pane is where you can read the body of the message.
The Reading Pane and the To-Do List can be toggled on and off as needed.

Answers

Answer:

A, B, and E.

Explanation:

I just did it!

Other Questions
Characterize the slope of the line in the graph,A. PositiveB. NegativeC. ZeroD. Undefined Archaeologists and historians agree on the exact date that human arrived in the Western Hemisphere. In which period did Japan begin to move away from Chinese and Korean influences and develop its own unique culture?A. when the Yayoi people came to JapanB. during Prince Shtoku's ruleC. under Emperor Kammus rule in HeianD. when the feudal system endedE. after the Battle of Sekigahara the sugar is sold at rupees 5.4 per kg at a loss of 10% at what price relative is sold per kg to earn a profit of 20% Noam solved the equation for k using the following calculations. k-7.6 = 10.35 + 7.6 +7.6 k= 1741 What error, if any, did he make? He should have subtracted 7.6 instead of adding it. He should have subtracted 10.35 from both sides. O He made a computation error when he added 10.35+746. O He made a computation error when he added -7.6 and 7.6. 70 points!!! Which of the following is an arithmetic sequence with common difference 5?A. 5, 25, 125, 626, ...B. 5, -25, 125, -625 ...C. 8, 3, -2, -7 ...D. 0, 5, 10, 15 ... Determine the intercepts of the line. Find angle 1 and angle 2 Select three ratios that are equivalent to 5:2Choose 3 answers:(Choice A)A2:5(Choice B)B10:4(Choice C)C20:50(Choice D)D35:14(Choice E)E55:22 please help me i neeed an help from you guys Write the integer that represents the opposite of the situation.A gain of 55 yards. What is a daughter cell? Example: "When a cell in the body divides, it will pass on a copy of its DNA to each of its daughter cells." tim ............ very much to go to school put the simple past tense In what way did the United States respond to the war in Europe? PercentsMichael is leaving a 15% tip for his waitress. What percent of theoriginal price will he pay? Write your answer as a percent, decimal,and fraction. 1. Calculate the mass of the product, if you started with 4 g of Zn and 3 g of H2CO3.Zn + H2CO3ZnCO2 + H2 * Ill cash app for the right answer plus explanation A group of Chemistry students have 1.0 mole each of two mystery substances, Substance X and Substance Y, at 50 C. Explain why a conclusion about the kinetic energy of each substance is not possible. (Write in short answer form--- 3-5 sentences) Beth saved $30 last summer while Carmen saved $80.what is the ratio of beths savings to Carmens PLEASE HELP Ok so I am totally dead because I fell behind in my school and it is hard for me to catch up. Does anyone have any tips. I will still give you brainily if you help. Thanks In the current year, Pendleton Company had income tax expense of $40,000 and net income of $200,000. If the times-interest-earned ratio for Pendleton was 13 during the current year, what was its interest expense