1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
cupoosta [38]
3 years ago
5

Write a program that reads a list of integers into a vector, and outputs the two smallest integers in the list, in ascending ord

er. 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.
Computers and Technology
1 answer:
AnnyKZ [126]3 years ago
8 0

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

Download cpp
You might be interested in
Select the focus questions that emphasizes what is more important: (Select all that apply) a.What needs to be relegated to the b
agasfer [191]

Answer:

Options b and d

Explanation:

Option B: What needs to be bigger and more prominent?

This gets the more foucs on the first look of the product to the user. Let's say you are developing a website and in the first page, your name and logo must be prominent and bigger than the rest of the elements on that webpage makes the user remember your name and the business model which gets more focus.

Option D: What needs to be brought into view in the foreground?

As the index says, face is the index of the mind, your product's index page is the face of your product. Hence it should be prioritized to show what is important and what is not.

The above two questions are the most important questions to be considered while emphasizing on what is more important.

5 0
3 years ago
The photo shows a group of girls reacting to comments they have read about a classmate on a social media site.
shepuryov [24]

Answer:

no

Explanation:

beacuse

3 0
3 years ago
why does it not let me create a new account when i log out of this one and go to join now after i fill everything out it wont le
frozen [14]
Try linking an email to your account, if it doesn’t work select forgot your password and you should receive an email where you can re make or change your password to something easier to remember. Are you using the same email account every time, this may also be the reason, if it is the same email they will not allow you to reuse it and it should tell you the email is already in use. Hope this helped
5 0
3 years ago
Which emerging technologies will have more injury on our day to day country &amp; How?​
qwelly [4]

Explanation:

Complete the sentence with the words below stop push direction slow down move shape speed up pull A force is a. or a.

4 0
2 years ago
Crystal detected a problem in a computer network, due to which she could not send or receive data within the network. She pings
babymother [125]
<span>Conflict of IP address in the computers. when computer are networked each computer is given a unique IP address. If two computers have the same IP there will be conflict which lead to failure in sending and receiving data within the network. It can be resolved by checking the IP addresses of each computer and correcting it.</span>
3 0
3 years ago
Read 2 more answers
Other questions:
  • SOMONE TELL ME THERE ROBLOX USER NAME AND DO U PLAY IT!!!!! MINE IS Borutouzimaki2133
    9·2 answers
  • Which of the following is NOT an example of input?
    8·1 answer
  • A windows host sends a tcp segment with source port number 1200 and destination port number 25. the sending host is a(n) _______
    10·1 answer
  • Which of these sites would need additional investigation to check for reliability?
    8·2 answers
  • Is there a relationship between cybercrime and traditional crime?
    6·1 answer
  • What is the missing line of code?
    7·1 answer
  • A business that helps people find jobs for a fee
    12·1 answer
  • What method of thermal energy is at work when heat lamps are used to warm up baby chickens?
    11·2 answers
  • Consider the following code segment.
    5·1 answer
  • Radio spectrum is the part of the complete range of electromagnetic waves that is used for radio communication from
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!