Complete a program that reads a vector index as input and outputs the element of a vector of 10 names at the index specified by the input. Use a try block to output the name and a catch block to catch any out_of_range exceptions. When an out_of_range exception is caught, output the message from the exception object and the first element in the vector if the index is negative or the last element if the index is greater than the size of the vector.

Answers

Answer 1

The program segment is an illustration of the try and catch program exceptions

The complete program

The program segment written in C++, where comments are used to explain each action is as follows:

//This opens the try block

   try{

       //This prints the vector element

       cout<<names[index];

   }

   //This opens the catch block

   catch (const std::out_of_range& oor) {

       //This prints the exception

       cerr << "Out of Range error: " << oor.what() << '\n';

 }

Read more about program segments at:

https://brainly.com/question/11623795


Related Questions

Write a function named `freq(l)` that takes a list `l` of numbers
and returns a tuple of the most frequent number and its frequency.
For example, `freq([1,2,3,4,5,2,3,4,5,3,4,5,4,5,4]) returns (4,5)
because number 4 appears 5 times in this list. If multiple numbers
appear as most frequent, then the first element of the returned
tuple is a list of all those numbers. For example,

freq([1,2,3,1,2,1,2,3,1,2]) will return ([1,2], 4) because both
1 and 2 appear 4 times in the list.

Answers

The function named `freq(l)` that takes a list `l` of numbers and returns a tuple of the most frequent number and its frequency is as follows;

def freq(l):

    s = { x for x in l }  

    lt = [ (x, l.count(x)) for x in s ]

    mn = max(lt,key=lambda item:item[1])[1]

    r = ([ x for (x,v) in lt if v == mn], mn)

    return r

print(freq([1,2,3,4,5,2,3,4,5,3,4,5,4,5,4]))

Code explanation;

The code is written in python.

we defined a function named "freq" and it accept an argument named l. The second line we get the unique values using sets.The variable "lt" is use to store list of tuple containing unique values and their occurrences in the list."mn" is a variable use to store the maximum number of occurrences.Then, the variable r is use to store the resulting tuple, filtering out all the items with less occurrences than the maximum.we returned the variable "r".Then we call our function with the parameter.

learn more on python here: https://brainly.com/question/4503928

4. All executed programs in the windows
environment is displayed on
the?

Answers

All executed programs in the windows environment are displayed on the Windows manger.

What is a program?

In Computer programming, a program can be defined as a sequence of instructions that are written in a specific programming language and can be executed or interpreted by a computer.

The programs that are executed in the windows environment by the operating system (OS) of a computer system are generally displayed on the Windows manger and stored in the computer's main memory, which is the random access memory (RAM).

Read more on programs here: https://brainly.com/question/23275071

Which term best describes the role of a printer in a network?
O shared resource
O server
O port
O router

Answers

Answer:

Correct answer is Shared Resource.

Explanation:

Answer:

Shared Resource

Explanation: Because multiple clients can use it

visual basic is an example of...

Answers

Answer:

Basic Programming language

Justin works for an automobile manufacturer. The company is designing a new car that enables the users to use the car as a mobile office. To achieve this, the car must provide an internet connection as an access point, mirror a smartphone screen on the LED dash display, and have a hands-free system where drivers can use voice controls to browse their phone's contact list, make and receive hands-free phone calls, and use navigation apps. Which technology should he use and why

Answers

The best technology that he should use to achieve the desired usage as described is; Bluetooth Technology

What is Bluetooth technology?

Bluetooth is a wireless technology that makes use of short-range RF transmissions.

This method of operation of bluetooth  is to aid users in connecting wirelessly to a wide range of computing and telecommunications devices by providing rapid connections between Bluetooth-enabled devices. Furthermore, Bluetooth provides the ability to mirror screens and use voice controls.

From the design of the new car, the best technology to be used is Bluetooth.

Read more about wireless technology at; https://brainly.com/question/24395331

When will a student most likely need to read a text aloud?

when doing homework
when studying for a test
when preparing a speech
when taking notes in class

Answers

Answer:When preparing a speech(c)

Explanation:

Answer:

C. when preparing a speech.

Explanation:

the only answer that makes sense :p

A Software application that access web application and websites

Answers

Answer:

Web Application

Explanation:

#carryonleraning

Select the correct answer.

Which is an attribute of analog communication?

A. Using a cell phone
B. Using cables to transmit data
C. Using binary
D. Using a DVD

ASAP pls! 20 points!​

Answers

Answer:

b

Explanation:

what amount of memory enough to store alatter of the alphabet or store a small number​

Answers

Answer:

It can be "ON" or "OFF". So it can store the numbers 1 and 0, but it certainly doesn't have the capacity to store a letter of the alphabet.

Explanation:

Microsoft PowerPoint is the best example of Multimedia Presentation Software. *


True or false​

Answers

Answer:

true yes it is a good example

Which is a benefit of collaboration and teamwork?

Answers

Answer:

Increases efficiency and productivity

Explanation:

A benefit of collaboration and teamwork is increased productivity and efficiency.

Collaboration and teamwork offer several benefits that can positively impact individuals and organizations as

1. Enhanced creativity and innovation: Collaboration brings together diverse perspectives, experiences, and skills. When individuals work together as a team, they can brainstorm ideas, challenge assumptions, and generate innovative solutions.

2. Increased productivity: Teamwork enables the division of tasks among team members, allowing for simultaneous progress on multiple fronts.

3. Improved problem-solving and decision-making: When multiple minds come together, there is a broader range of knowledge and expertise available to tackle complex problems.

4. Enhanced communication and interpersonal skills: Collaborating in a team environment necessitates effective communication and active listening.

5. Increased motivation and engagement: Working as part of a team can foster a sense of belonging and shared purpose. Collaboration allows team members to feel supported and valued, leading to increased motivation and engagement.

6. Building strong relationships and trust: Collaboration requires trust, respect, and cooperation among team members. Through collaborative experiences, individuals can build strong professional relationships based on mutual support and shared goals.

Learn more about Collaboration and teamwork here:

https://brainly.com/question/14394282

#SPJ4

40 POINTS AND IF CORECT I WILL MARK AS BRAINLIEST
Which part of project management involves determining the overall work?

Breakdown
Incomes
Scope
Time

Answers

Answer:

I think it's income.

Explanation:

Answer:Time because stermining your overall work and what you’ve done includes time

Colin found a website he would like to use for his research assignment. What should he look for to determine if the website is reliable?

He should determine if the website is entertaining.
He should look for goods and services on the website.
He should look for opinions on the website.
He should look for when the website was last updated.

Answers

Answer:

He should look for when the website was last updated.

Explanation:

if the website is out of date, then the sources may not be as reliable or accurate

Analyze and interpret this statement "life is not a grand harmony, conflict exist"

Answers

Answer:

Life is not always easy and fair. There will be ups and downs, happy and sad. You have to fight for for everything good in this world because nothing good comes easy.

Use a recursion tree to determine a good asymptotic upper bound on the recurrence T(n) = 4T(n/2 + 2) + n. Use the substitution method to verify your answer.

Answers

Answer:

Follows are the solution to this question:

Explanation:

The scale of the subproblem for a node is [tex]\frac{n}{2^i}[/tex]  at depth.  

The tree then has lg n + 1 and [tex]4^{lg n} = n^2[/tex]leaves.  

Complete costs for all depth I nodes for I = 0. 1 , 2, ......, lg n-1 is:[tex]4^i ( \frac{n}{2^i}+ 2 ) = 2^i n + 2\times 4^i.[/tex]

[tex]T(n)= \sum_{ i = 0}\lg n - 1( 2^i n + 2 . 4^i )+ \Theta (n^2)\\\\[/tex]

        [tex]= \sum_ {i = 0} \lg n - 1 2^i n + \sum_{i = 0} \lg n - 12 \times 4^i + \Theta (n^2)\\\\= [ \frac{ 2\lg n - 1}{ 2 - 1} ]n + 2 \times [ \frac{ 4\lg n - 1}{ 4 - 1} ]n + \Theta (n^2)\\\\= ( 2\lg n - 1) n] + (\frac{2}{3})( 4\lg n - 1)+ \Theta (n^2)\\\\= (n-1)n - \frac{2}{3} (n^2 -1) +\Theta (n^2)\\\\= \Theta (n2)\\[/tex]

verfify the value:

[tex]\to T(n) \leq c (n^2 - dn) \\\\T(n) = T(n) = 4T((\frac{n}{2}) + 2) + n \\\\ \leq 4c [ ((\frac{n}{2}) + 2)2 - d((\frac{n}{2}) + 2) ]+ n \\\\ \leq 4c [ (\frac{n^2}{4} + 2n + 4) - \frac{dn}{2} - 2d)]+ n \\\\\leq cn2 + 8cn + 16c - 2cdn - 8cd + n\\\\\leq cn2 -cdn + 8cn + 16c - cdn - 8cd + n\\\\\leq c(n2 -dn) - (cd- 8c - 1)n - (d - 2). 8c\\\\\leq c(n2 -dn),\\\\[/tex]

Where there is the last stage for  [tex]\to cd - 8c -1 \geq 0[/tex].

List two advantages and disadvantages on conversion of number systems

Answers

Answer:

Look at the explanation!!

Explanation:

Computer number systems are built around the core processor. Most of these are binary, but trinary machines have also been considered.

Working in binary is faster, since one already handles the carry, and there is no weird carry rules like BCD would use. On the other hand, it is possible to implement this in hardware too.

On the other hand, one has to convert stuff from binary to something more readable, like decimal or whatever.

Computers do not store negative numbers as such. Instead, they use a cycle of 256 (or some power), and negative numbers are given as 256-n, for example, -5 would be 251, or worse still 4294967291, that is in hex, FFFFFFFFB, since adding 5 to this would give 0 = (1)00000000, the 1 is lost.

In ternary numbers, the values are different, and a balanced ternary, with digits of -1, 0, 1, would express negative numbers quite easily, eg -5 is 0000000M11, that is -9+3+1 = -5. It’s still possible to determine the sign of this number, but you have to pass it through a special gate to find the first non-zero digit, ie here M.

How to trigger watchers on initialization in vue.js ?

Answers

Answer:

variable when the component is mounted. This triggers the watchers which then triggers an emit i have in the watcher. I do not want the emit to happen when the variable is only being initialized. The variable is from the data section of the vue component.

Write a program that: program starts; declares and initializes to .06625 constant float variable NJSALES_TAX; declares and initializes to 1000 an integer variable total; declares and initializes to zero a float variable grand_total; prompt and input on new line total; calculate grand_total to equal total plus (total*SALES TAX); if grand_total <= 1000 print on new line "Grand total is less than or equal to 1000 it is $" and the grand_total to two decimal places; else if grand_total between 1000 <= 2000 print on new line "Grand total is more than 1000 less than or equal to 2000 it is $" and the grand_total to two decimal places; else print on new line "Grand total is greater than 2000 it is $" and the grand_total to two decimal places; just before ending print on new line "Program finished!" then terminate program.

Answers

Answer:

Written in C++

#include<iostream>

using namespace std;

int main() {

const float SALES_TAX = 0.06625;

int total = 1000;

cout<<"Total: ";

cin>>total;

float grand_total = 0;

grand_total = total + total * SALES_TAX;

if (grand_total <= 1000) {

cout<<"Grand total is less than or equal to 1000 it is $";

printf("%.2f", grand_total);  

}

else if (grand_total > 1000 && grand_total <= 2000 ) {

cout<<"Grand total is more than 1000 less than or equal to 2000 it is $";

printf("%.2f", grand_total);  

}

else {

cout<<"Grand total is greater than 2000 it is $";

printf("%.2f", grand_total);  

}

cout<<"\nProgram finished!";

return 0;

}

Explanation:

I've added the full source code as an attachment where I use comments to explain difficult lines

A computer can perfome three basic types of operations, mathematical, logical and ...........​

Answers

Answer:

The basic operations performed by a computer are arithmetic operations, logical operations and storage and relative functions.

Explanation:

Answer:

the three basic operations performed by a computer are 1. mathematical or arithmetic operations. 2. logical operations

3 storage and relative operations.

List 3 tanks that a computer can perform ​

Answers

Answer:

Input, output, processing, and storage

Explanation:

Computers deal with input, how much information and letters and whatnot is typed or inputted on a computer. They also deal with output, the result of an input value. In between the input and output stages, they process the information before returning the output value. They have storage for history and a short RAM list, so they can remember all the input values inserted recently.

Name and describe the seven types of things that can be added to websites to increase audience engagement. hurry please :3

Answers

Answer:

Java script functions, example, buttons that perform an action or on click.Responsive webpages. This is so the screen can resize depending on your device.Pagination, where a user can use a link to get to another part of the same page if it is too long.Styling. This is essential to good-looking web pages.Customization. This is so that the user can change the page to their liking. It is complicated, but different than styling.Good GUI. Graphic user interface is interactive, and is used to create login forms and such.Images. Images can describe things more than words and can have very deep meaning.

Hope this helps!

C a n_ I_P l s_H a v e_S u b s_O n_ Y T

Answers

Answer:

Ok

Explanation:

Answer: No

Explanation:

The 2960 switches have been taken out of the box and cabled, and PC2 can communicate through R1 with the rest of the IP network. However, no configuration has been added to either SW1 or SW2. As a result, the network engineers sitting at a management station to the right of R1 cannot ping or telnet to SW2. Required:
What configuration commands, when entered in the correct order on SW2, allow the network engineer to ping or telnet to SW2 from the management station?

Answers

The correct order of configuration commands on switch 2 (SW2) that would allow the network engineer to successfully ping or telnet to SW2 from the management station are:

Enter IP address of switch 2 (SW2).Set IP default-gateway.Configure interface VLAN 1.No shutdown

What is a command?

A command can be defined as a set of instructions that are typically used to configure a network device such as a switch, so as to make it active on a computer network and enable it perform certain tasks automatically during network communication.

In Computer networking, commands can be used to ensure the interfaces (ports) on a switch are active and open for connections from other network devices such as:

RoutersWorkstations (computers)

In this scenario, the network engineer should use the following configuration commands on switch 2 (SW2), so as to successfully ping or telnet to SW2 from the management station are:

Enter IP address of switch 2 (SW2).Set IP default-gateway.Configure interface VLAN 1.No shutdown

Read more on a switch here: https://brainly.com/question/13243868

Which option is used once a sparkline has already been inserted to format it to a particular type and color? Insert tab, Sparklines group Insert tab, Filters group Sparklines Design contextual tab Sparklines Format tab

Answers

Answer:

A. Insert tab, Sparklines group

Explanation:

Answer:

a your welcome

Explanation:

I’m select circumstances is a permissible character on the Mac operating system

Answers

Answer: /

Explanation: Answer

Explain the following IT terms Network: Packet: Router: IP address: Server: LAN: WAN: Bus topology: Ring topology: Star topology: Mesh topology: ISP: Dial-up: DSL: Cable Broadband: Fiber Optic: Mobile: explain all pls

Answers

Answer:

IT terms Network:

Networking, also known as computer networking, is the practice of transporting and exchanging data between nodes over a shared medium in an information system.

Packet: Networking, also known as computer networking, is the practice of transporting and exchanging data between nodes over a shared medium in an information system.

Router: A router is a networking device that forwards data packets between computer networks. Routers perform the traffic directing functions on the Internet.

IP address: For the most part, an IP address tells you the city, ZIP code, or area code of your ISP, as well as your ISP's name. What can an IP address tell you? To some degree, your physical location and also the name of your ISP

Server: A server operating system, such as Windows Server or Linux, acts as the platform that enables applications to run. The operating system provides applications access to the hardware resources that they need and enables network connectivity. The application is what enables the server to do its job.

LAN: A local area network (LAN) consists of a series of computers linked together to form a network in a circumscribed location. The computers in a LAN connect to each other via TCP/IP ethernet or Wi-Fi. A LAN is normally exclusive to an organization, such as a school, office, association or church.

WAN: A wide area network (also known as WAN), is a large network of information that is not tied to a single location. WANs can facilitate communication, the sharing of information and much more between devices from around the world through a WAN provider.

Bus topology: also known as line topology, is a type of network topology in which all devices in the network are connected by one central RJ-45 network cable or coaxial cable. The single cable, where all data is transmitted between devices, is referred to as the bus, backbone, or trunk.

A ring topology: is a network configuration where each networked device is connected to two other devices on either side of it to form a circular “ring” data path. When data is transferred in a ring topology, the data is sent in one direction along the single continuous pathway.

Star topology: is a network topology in which each network component is physically connected to a central node such as a router, hub or switch. In a star topology, the central hub acts like a server and the connecting nodes act like clients.

A mesh topology: is a network setup where each computer and network device is interconnected with one another. This topology setup allows for most transmissions to be distributed even if one of the connections goes down. It is a topology commonly used for wireless networks.

Your ISP: is the company that gets you onto the Internet – your home Internet or mobile data provider. If your ISP is spying on you, it means they can use or sell your browsing history to others for things like creepy ads that follow you around the Internet or to junk mail providers.

Dial up: relating to or being a standard telephone line used for computer communications also : accessible via a standard telephone line a dial-up Internet provider.

DSL: DSL stands for Digital Subscriber Line, and describes a family of technologies used for digital data transmission and connection to the Internet. It is a type of broadband communication service available to homes and businesses that uses existing phone lines without interrupting telephone use.

Cable Broadband:  Cable broadband connects your home to a fibre cabinet in your area. However, instead of using copper wires, cable broadband uses coaxial cables to connect to the cabinet, giving you a much faster internet connection than the traditional copper phone line cables used for 'superfast' broadband connections (up to 60Mbps)

Fiber optics: is used for long-distance and high-performance data networking. It is also commonly used in telecommunication services, such as internet, television and telephones.

A mobile network (also wireless network) route's communications in the form of radio waves to and from users. It is composed of base stations that each cover a delimited area or "cell." When joined together these cells provide radio coverage over a wide geographic area.

Explanation:

Describe the big data life cycle. Which step do you think is most useful and why?

Answers

Answer:

Big data lifecycle consists of four phases: data collection, data storage, data analysis, and knowledge creation. Data collection phase consists of collecting data from different sources. In this phase, it is important to collect data from trusted data sources.

I think business cases analysis is the most useful step because (BCA) provides a best-value analysis that considers not only cost but other quantifiable and non-quantifiable factors supporting an investment decision. This can include but is not limited to, performance, producibility, reliability, maintainability, and supportability enhancements

Explanation:

mark me brainliest

any two example of numeric​

Answers

Answer:

Numeric is anything of, relating to, or containing numbers. The numbering system consists of ten different digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. If a value is an alphanumeric, it contains letters and numbers.

What are some of the challenges of note-taking? Check all that apply.

It can take up a great deal of time in class.
It can lessen preparation time before tests.
It does not support retention for the student.
It can be distracting in the middle of a lecture.
It can cause the student to miss information.

Answers

Explanation:

it can take up a great deal of time in class.

it can be distracting in the middle of a lecture.

it can cause the student to miss information.

These are some of the challenges of note taking:

It can take up a great deal of time in class.It can be distracting in the middle of a lecture. It can cause the student to miss information.

Note-taking can be described as the jotting of important details on a book or notepad during a lecture or class.

Note taking is very important because the student can also refer to it when needed to extract important information.

With its advantages, it also has some disadvantages for the learner.

The learner may become too engrossed in his note taking and end up missing out on other things that are being done in the classroom.

Also it could cause the student to stop listening further to what is being taught. They may become too engrossed with copying what they had heard earlier.

Read more on note-taking here: https://brainly.com/question/17184401

Josh's boss asked him to write a letter to their customers explaining some upcoming price increases, but Josh was in a hurry to get off work, so he didn't take the time to get the information he needed to explain the increase. As a result, the e-mail was confusing and disorganized. Josh's e-mail has the characteristics of _____.

ineffective communication
workplace communication
effective communication
barriers to communication

Answers

Answer:

ineffective communication

Explanation:

Other Questions
How did Henry Clay and Daniel Webster try to save the Bank and defeat Jackson at the same time?fifty points if answered correctly What is the slope of the line that connects the points (-1,9)and (3, 25)? How did the huang river civilization develop differently from other river valley civilization PLEASE HELP!! What is the equation of the following graph in vertex form? The table below describes political party associations of governorsbased on the table, what has been an impact of political parties on policy making?a) more democratic issue positionsb) the number of republicans nominated for governor increasedc) the number of democrats nominated for governor increasedd) more republican issues positions have shaped federal policy what is the correct plural of try? When both distance and direction are considered, motion canbe represented by a Which quality of the hudson river school art is displayed in this painting jiskha what are the New york beliefs What is your favorite animal?I want a detailed reason why you like them, Up to 1 to 2 sentences.Enjoy the points as well :D Mario has completed the first step in his HR planning, and is ready to begin the second step, which is Dan loves to compete in triathlons. At a race a few months ago, he finished in 300 minutes. Yesterday, he completed another triathlon and finished in 306 minutes. What was the percent of increase in Dan's finishing time? Isaac is working two summer jobs, making $8 per hour walking dogs and making $16per hour tutoring. In a given week, he can work a maximum of 8 total hours and mustearn no less than $80. If x represents the number of hours walking dogs and yrepresents the number of hours tutoring, write and solve a system of inequalitiesgraphically and determine one possible solution. Intelligence Quotient (IQ) scores are often reported to be normally distributed with =100.0 and =15.0. A random sample of 59 people is taken. Step 1 of 2 : What is the probability of a random person on the street having an IQ score of less than 98 ? Round your answer to 4 decimal places, if necessary. How were 300 000 soldiers evacuated from Dunkirk? Explain briefly in own words just a few sentence not paragraphs. (Ill brainlist!) The vertex is located at (8.33, 236.67).What does this point represent in context? Use the elimination method to solve the system of equations. Choose thecorrect ordered pair.12x - y = 259x+y = 17A. (-2,3)B. (2, -1)O C. (1,-2)D. (3,-2) Most workplace communications will involve routine messages that are positive or neutral. Therefore, they should be organized using the ____________________ strategy. 415x$x + yUse the work shown. Which expression is equivalent to2 3 2 4 1.39Y-X+-y?55 3X +No(3)4y -2 2Ox+ch59 34-5%O-Y4 22 3x + -+-y+=X592 24O7XColt5353 3492.317 2X+-+y5 9 Which statement regarding these four states is true? the state with the lowest population has the greatest population density. the state with the second lowest population has the lowest population density. the state with the lowest population has the lowest population density. the state with the second greatest population has the lowest population density.