Write a program that reads a list of integers into a vector, and outputs the two smallest integers in the list, in ascending order. The input begins with an integer indicating the number of integers that follow. Ex: If the input is: 5 10 5 3 21 2 the output is: 2 and 3 You can assume that the list of integers will have at least 2 values. To achieve the above, first read the integers into a vector. Hint: Make sure to initialize the second smallest and smallest integers properly. Submit your .cpp code with this question's link. Output runs are not required.

Answers

Answer 1

Answer:

In C++:

#include <bits/stdc++.h>

#include <iostream>

#include <vector>

using namespace std;

int main(){

vector<int> vectItems;

cout << "Vector length: ";

int ln; cin>>ln;

int num;

for (int ikk = 0; ikk < ln; ikk++){

 cin >> num;

 vectItems.push_back(num);}

int small, secsmall;

small = secsmall = INT_MAX;  

for (int ikk = 0; ikk < ln; ikk++){

 if(vectItems[ikk] < small){

     secsmall = small;  

           small = vectItems[ikk];   }

 else if (vectItems[ikk] < secsmall && vectItems[ikk] != small) {

           secsmall = vectItems[ikk];} }

 cout<<small<<" "<<secsmall;

 return 0;}

Explanation:

See attachment for program file where comments are used for explanation


Related Questions

The following if statement tests the rainfall in New York’s Central Park during the months of June, July and August.

if (low <= rain && rain <= high)
System.out.println("Rainfall amount is normal.");
else
System.out.println("Rainfall amount is abnormal.");
It could be replaced with:
I.

if (rain >= low)
{
if (rain <= high)
System.out.println("Rainfall amount is normal.");
}
else
System.out.println("Rainfall amount is abnormal.");
II.

if (rain >= low)
{
if (rain <= high)
System.out.println("Rainfall amount is normal.");
else
System.out.println("Rainfall amount is abnormal.");
}
else
System.out.println("Rainfall amount is abnormal.");
III.

if (rain >= low)
System.out.println("Rainfall amount is normal.");
else if (rain <= high)
System.out.println("Rainfall amount is normal.");
else
System.out.println("Rainfall amount is abnormal.");
I only
II only
III only
(II or III)
I, II or III

Answers

Answer:

II only

Explanation:

In the original code, both conditions of low<=rain and rain >= high must be met for the print message to be executed. This is denoted by the && logical operator.

The code in II does the same thing. It first checks that the low <=rain condition is true; then it goes on to check if the rain >= high condition is true as well before the "normal" print statement can be executed. But if either of the condition is not true, it prints "abnormal" because both conditions must be true.

In most software programs, which color arrows selects the points in a vector
Black
White
Gray
Red

Answers

Answer:

in think gray is used as arrow color which selects the points in a vector

7. What is a slide transition?

Answers

Answer:

Is this multiple choice? If not, its a visual effect from one slide to another.

Explanation:

Answer:

A slide transition is the visual effect that occurs when you move from one slide to the next during a presentation. You can control the speed, add sound, and customize the look of transition effects

Explanation:

hope this helps:)

The decimal equivalent of the product of 1011 and 1100 is

Answers

Answer:

132

Explanation:

We convert each number to base 10 (decimal) and multiply.

So 1011₂ = 1 × 2³ + 0 × 2² + 1 × 2¹ + 1 × 2⁰

= 1 × 8 + 0 × 4 + 1 × 2 + 1 × 1

= 8 + 0 + 2 + 1

= 11₁₀

1100₂ = 1 × 2³ + 1 × 2² + 0 × 2¹ + 0 × 2⁰

= 1 × 8 + 1 × 4 + 0 × 2 + 0 × 1

= 8 + 4 + 0 + 0

= 12₁₀

So, 1011₂ × 1100₂ = 11₁₀ × 12₁₀ = 132₁₀

So, the decimal equivalent of the product of 1011 and 1100 is 132

Use the drop-down menus to match each description to the correct term.
Stores information in columns and rows
Smallest unit of information, e.g. 25
Unique identifier for each record, often an ID number
Group of related tables or records
Set of unique information, stored in a row

Answers

The appropriate term with its description are:

Excel spreadsheet: it stores information in columns and rows.Bit: smallest unit of information, e.g. 25.

What is an excel spreadsheet?

A excel spreadsheet can be defined as a type of software program which is designed and develop with cells that are typically arranged in a tabulated format in rows and columns.

How to match the description to the correct term?Excel spreadsheet: it stores information in columns and rows.Bit: smallest unit of information, e.g. 25.Key field: unique identifier for each record, often an ID number.File: it is a group of related tables or records.Primary key: set of unique information, stored in a row.

Read more on spreadsheets here: https://brainly.com/question/4965119

#SPJ2

List 5 general safety precautions that you can take when working with a computer equipment.

Answers

Answer:

Wear the right clothes, unplug all equipment, keep your work area clean, check for damaged parts, and do not force components into ports.

Explanation:

These are all general safety precautions when working with computer equipment.

What is a difference between Java and Python? (5 points)
a
Java requires brackets to define functions, while Python requires curly braces.
оо
Ob
Python ends lines of code with semicolons, while Java does not.
Python is a statically typed language, while Java is not.
Od
Variable types in Java cannot be changed, while Python allows them to change.

Answers

I'm not sure if this answers your question but I found this online:

The main difference between Java and Python is their conversion; the Java compiler converts the Java source code into an intermediate code called a bytecode while the Python interpreter converts the Python source code into the machine code line by line.

Sorry if this doesn't answer your question.

I'm not sure if this answers your question but I found this online:

The main difference between Java and Python is their conversion; the Java compiler converts the Java source code into an intermediate code called a bytecode while the Python interpreter converts the Python source code into the machine code line by line.

Sorry if this doesn't answer your question.

What is printed by the python code? print('2' + '3')

Answers

Answer:

23

Explanation:

Given

print('2' + '3')

Required

The output

First, the expression in bracket is evaluated.

'2' + '3' = '23' i.e. The + concatenates '2' and '3'

So, the statement becomes

print('23')

The above statement prints the expression in quotes.

Hence, the output is 23

Answer:

23

Explanation:

What value is returned by the call mystery(2, 3, 6)?

answer choices:

9

10

14

8

20

Answers

Answer:

8888888888888888888888888888Explanation:

yyugjhgfgdsfsghgtredfzgxhcjvkiu

To print preview a document, navigate to the _____ tab and select the Print option. File Page Design View Insert

Answers

Answer:

Option A

Explanation:

The process of viewing the print preview option in MS word is as follows -

a) First of all click on the File tab

b) After clicking on file tab, click on the print button at the left hand side

c) In the new tab that open up after clicking on the print button will provide an option of print preview.

Hence, option A is correct

Answer:

b. page layout

Explanation:

___ design uses the same webpage content, but applies styling depending on the viewport size of the device

Answers

coding design used snake

would you be comfortable with a robot adjusting your investment portfolio if it came with significantly lower fees than a human financial advisor? Why or why not

Answers

Answer:

Sure, as long as it gets the job done and doesn't screw things up & is user friendly. I would also want to be able to turn it on and off at will.

Explanation:

PLS HELP IM SO DESPERATE!! 40 points


Consider how you would help your Uncle Sandro diagnose the location of the problem and offer a likely solution in the following scenario:

Uncle Sandro has a computer. It is an older model. He calls you in as his tech-savvy nephew and asks if you could help him. It seems like data that is traveling across his computer is getting corrupted, and there is not a clear source. He asks you what the problem is and how he might fix it.

Answers

You would reboot the computer install a VPN and a virus detector

Answer:

1 reboot the computer

2 install a VPN and  virus detector

Explanation:

Do you think the benefits outweigh the risks? Why or why not?

Answers

Answer:

Varies By Person. This question is formed to make you think, it's addressed to you. There are no, wrong or right answers. Just needs to be answered with reason to back up your opinion.

Explanation:

Do you think the benefits outweigh the risks? Why or why not?

In my opinion, the benefits always outweigh the risks. This is due to the common nature that the majority of people will view everything in life, every transaction by how much it benefits them. People will also consider what those benefits are. If thing x only has one benefit but it's one I really want, I may take on the 2+, 5+, or 10+ risk that comes with it.

Although that's just my opinion, others may differ, you just need to find your stance.

What tool do you use to fill a cell with color?
Sort
Fill Color
Bold
Function bar

Answers

to fill a cell with Color you will usethe fill Color tool

Don't Answer if you are going to give me a link! Don't Waste My Points!

An image is considered a portrait if the person is looking into the camera lens.

A.
True

B.
False

Answers

Answer:

Hello there! :) It could be considered a portrait but that is not exactly what a portrait is.

Explanation:

A portrait is mostly considered a painting or drawing of someone that that same person has drawn. For example, a portrait of the Mona Lisa would have been her drawing/painting herself. Now someone just looking at camera lens would'nt exactly be true, it would be false so the answer is B. False

Hope this helps!

Answer: False

Explanation: I don't know 100%, but it wouldn't make sense if it was because the person can be really far away and still be looking at camera, as well as be looking slightly away from lens and it still look like a portrait.

What are some common summary operations that aggregate functions can perform in a crosstab query? Check all that apply.
adding
counting
dividing
subtracting
identifying an average
calculating a minimum or maximum
predicting the next value in a pattern.

Answers

Answer:

adding

counting

identifying average

calculating max or min

Explanation:

edg 2021

Ryan is installing new flooring in his house. Ryan can install 169 square feet of flooring in 5 hours. How much new flooring can Ryan install in 35 hours?

Answers

Answer:

1183 square feet.

Explanation:

If Ryan can install 169 square feet in 5hours.

Then, he can install times 7 of that in 35 hours since 35 / 5 = 7

So, 169 x 7 = 1183

Any tips or tricks I can use on my phone?​

Answers

Answer:

What phone you got mate? I'm interested

Answer:

No ffrjrirrjj dudjddiejejej

PI
s
ne
poem for the
During reading: Work
on the following questions:
suggests
I
a
1
b
What do you predict the poem will be about?
How does the shape support what the titles
How many stanzas does the poem have?
b How many sentences does it have?
3 Read the poem aloud in your group.
2
a
m
Until I saw the Sea by Lilian Moore
ou the Sea​

Answers

Explanation:

As the qn was copy pasted from another document...the qn seems incorrect... and incomplete..

pls see to it and attach the correct qn...

sorry

I downloaded the hex mod on gamebanana, there was a "do NOT readme" file, I didn't see it at first and tried to open the app, it said "Unrecognized app" I really hope I didn't just get a virus on my computer, the game is fnf

Answers

Answer:

You'll be find. Viruses suck, but everyone gets them at some point. Don't be worried about it. If your computer is acting weird/getting pop-ups, just ask your parent to call the computer company or take it to the store that's owned by your internet provider company (AT&T store, etc.)

Getting a virus is not the same thing as a cyber-attack. It might make things a bit annoying. Worst case scenerio, someone uses a virus software program to gain access to your computer so they can try to find banking info.

Even if that happens (VERY low chance), financial companies associated with your credit card/financial info, etc. pick up on it pretty quickly and call if there's anything suspicious.

Explanation:

Answer:

if its friday night funkin its not a virus

Explanation:

explain types of fans & their function​

Answers

Answer: 1. Ceiling Fan: As they are suspended into the middle of the room, they transfer air in equal quantity.

2. Table Fan: Used in small purpose office room and home tables for max. 5 people.

3. Tower Fan: Take lesser space, compact and portable, used to maintain and encourage air flow.

4. Pedestal/Stand Fan: Used in rooms with larger space, make less sound, are portable and used in a single room at a time for up to 10 people.

5. Exhaust Fan: Used in bathrooms and kitchens to provide ventilation and remove any odour or smoke.

               

Explanation:

List at least two questions you can use to help decide whether a website's information is trustworthy

Answers

Answer:

Questions (three) that can be used to decide whether a website's information is trustworthy are;

1) Who is or are the authors of the website

2) What type of information the website conveys

3) Why was the information published on a website

Explanation:

1) Who is or are the authors of the contents of the website including the authors credentials so as to ascertain whether the author is qualified with regards to the topic or topics written about on the website

2) What are the information presented on the website and the context the in which the information are presented

Are the articles in the website backed by a source, with hyperlinks, references or footnotes

3) Why was the on the website information created. Is the information to entertain, persuade, sell or inform

draw a flowchart to input a number and find out whether it is divisible by 7 or not​

Answers

Note:

% is Modulus,

So it's taken as num mod 7, if that evaluates to 0 there is no reminder therefore divisible by 7.

What is one difference between low- and high-level programming languages?
O Low-level programming languages consist of written messages, while high-level programming languages are made up of numerals.
O Low-level programming languages do not have to be translated, but high-level programming languages do.
O Low-level programming languages are more similar to human language than high-level programming languages.
O Low-level programming languages must be interpreted or compiled, but high-level programming languages do not.

Answers

Answer:

Both High level language and low level language are the programming languages’s types.. The main difference between high level language and low level language is that, Programmers can easily understand or interpret or compile the high level language in comparison of machine.

Explanation:

The primary distinction between high-level and low-level languages is that programmers can readily comprehend or interpret humans in high-level languages, but machines can only easily understand humans in low-level languages. Thus, option C is correct.

What low- and high-level programming languages?

Low-level language operands and binary code instructions are swapped out for middle-level language mnemonics. However, since mnemonics are not understood by computers, we must translate them into machine code using a program called Assembler.

The types of programming languages are high level and low level languages. High level languages are distinguished from low level languages primarily by their ease of understanding, interpretation, and compilation by programmers.

Therefore,  Low-level programming languages are more similar to human language than high-level programming languages.

Learn more about programming languages here:

https://brainly.com/question/23959041

#SPJ2

Tell me what does WSG mean ​

Answers

Answer:

It could mean many different things but heres some things it could

With Special Guest

World Standard Group

Web Security Guard

Hope this helps!

What is media logic according to David L. Altheide?

Answers

Answer:

Media logic is discussed as a general framework for understanding the nature, impact and relevance of media and information technologies for social life, as well as its use and appropriateness for investigating political communication. (According to David L. Altheide)

Explanation:

The First National Bank debited $100.00 from your checking account into your savings account. What would the transaction descripton be?

Answers

Answer:

32 Day Interest Plus

Amount 1 - 32 days (per annum) 33 - 64 days (per annum)

R1 000 - R9 999 0.55% 0.65%

R10 000 - R24 999 0.80% 0.90%

R25 000 - R49 999 1.05% 1.15%

R50 000 - R99 999 1.55% 1.65%

Explanation:

does trend in computing important for organization management?​

Answers

Answer:

yes it is...................

Dose anybody know how to do this because i dont.

Answers

Answer:

All you need to explain in this assignment is specific things which makes a product an innovationi or new. This is what emerging means in the first question. Then say why these new technologies can be hard to identitfy.

Explanation:

Other Questions
Which of these are functions of the liver? (Select all that apply.)secretes bile for fat break down into the gall bladderfilters poisons from the bloodsecretes hydrochloric acid into the stomach to break down foodstores vitamins, minerals, fats, and ingredients for making glucose The table shows the participation in a school's debate club during the last four years.Year 1 2 3 4Students14192533Between which two years did the club see the greatest growth? By what percent did it grow?The greatest growth was between years 3 and 4. The growth between those years was about 32%.The greatest growth was between years 1 and 2. The growth between those years was about 5%,The greatest growth was between years 3 and 4. The growth between those years was about 8%.The greatest growth was between years 1 and 2. The growth between those years was about 36%. Which of the following is not a reason that authors use text features in information texts?A.) Authors use text features in informational works to keep the reader from having to read the entire informational work.B.) Authors use text features in informational works to make information more easily understandable to the readerC.) Authors use text features in informational works to guide readers through the information.D.) Authors use text features in informational works to make the information for easily accessible to readers. What kind of jewish people were rounded up and sent to Nazi camps 5 things that were going on in Europe in ww1 What is the two ratios equivalent to 3 to 4 what does transcontinental mean? What are the two most important changes that occur with matter? Select two answers. A fruit basket of mass 44.5 kg weighs approximately how much in newton? (Answer should have a number and a proper unit) * Nina's monthly budget is $2,250. Every month she makes the following payments: $175 for insurance $129 for utilities $283 for taxes Which is the highest house payment she can afford? A. House A - monthly payment: $1,580.89 B. House B - monthly payment: $1,790.25 C. House C - monthly payment: $1,989.23 please hurry, will give 20 points per sentence and brainliest if you answer all with 2-3 sentences!4. Describe Asokas rule before and after he converted to Buddhism.5. As newcomers to India, the Aryans exchanged culture with the people living there. Describe what the Aryans gave to Indian society and what they learned from the people living there. 6. If you had to choose, would you choose to live in the Mauryan or Gupta Empire? Identify each word as having a positive or negative connotation,Positive ConnotationNegative connotationstubbornuptightcuriousdeterminednosytraditional Necesito un crucigrama e la lectura implicita y explicita con sus respectivas respuestas Pls help no links pls What happen when RBC added with distilled water? which equation has the least steep graph? A. y= -3/4x-9 B. y=-7x-2 C. y=1/4x+6 D.2x+1 who was the leader of the Germans during WWII Does drought have to do with geologic in nature? SOMEONE PLS ANSWER THIS IK THERES NO PICTURE WITH IT BUT I NEED THE ANSWER BADLY. Do you think what you observed is evidence that genes are instructions for proteins? Why or why not? Which statement about correlation and causation is true? A) Correlation implies causation. B) Causation implies correlation. C) No correlation implies causation. D) No causation implies no correlation.