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
A slide can have which of the following?
Margarita [4]

Answer:

D all of them mofos

Explanation:

7 0
3 years ago
Yo, what's the tinyclick.ml/7hTq link?? I don't trust it, but I'm curious-
Rashid [163]
<h2>Answer:</h2>

<u><em>Usually, random people will say that on your questions page to give you a virus but then that link doesn't look like the same link I see every day. I would still not click it just in case.</em></u>

<h2>Explanation:</h2>

<em>Have a good one!</em>

<h2>( ◑‿◑)ɔ┏--┑٩(^◡^ )</h2>
5 0
3 years ago
​_____ refers to​ internet-based platforms that allow users to create their own content and share it with others who access thes
liberstina [14]
This would be considered a social media platform due to it allowing people to share content.<span />
6 0
3 years ago
Your organization's IT department has developed a custom application that reports the hostname of each client that tries to acce
Andrews [41]

Answer:

Configure DC1 to forward name resolution requests to 192.168.3.0

Explanation:

DC1 is configured in order to use forwarders so that they can send unresolvable host name requests to a DNS server at the main office or the head quarters.

This also prevent sending of DNS spoofing attack  to a DNS client

5 0
3 years ago
Describe the Sign in process of an Email account.​
Inga [223]
User inputs email. User inputs password , if password and username match user allowed through.If not password or email address is incorrect notification is shown - and there also may be a limit on the amount of attempts you have to get it right.
8 0
3 years ago
Other questions:
  • Which of the following statements is false? Speaking to your computer is a form of input. Playing a video is an example of outpu
    10·1 answer
  • What is the most widely used operating system for mobile devices?
    7·1 answer
  • Write the HTML to create a hyperlink to the named fragment designated by “top”.
    10·1 answer
  • Brooke is trying to save enough money in the next fifteen months to purchase a plane ticket to Australia. Every month Brooke sav
    9·1 answer
  • The type of human hair wig that is the most costly is:
    12·1 answer
  • A hard drive with a spin speed of 7200 RPM, commences spinning at time = 0, at time = 1.326 ms what is the angle that the disk h
    14·1 answer
  • have you ever had to adjust your communicatio style to egage a customer or roommate? what was the situation and outcome?
    5·1 answer
  • Who knows songs that are sad,happy,excited, and calm
    10·1 answer
  • Which important aspect of the Roman Empire did the barbarians destroy?
    14·2 answers
  • An optical drive randomly becomes unavailable, and after replacing the drive, the technician now suspects that the drive may not
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!