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
Find examples of conic sections in art and architecture. Visit Web sites to find pictures of artwork or buildings that illustrat
liubo4ka [24]

The question above wants to assess your interpretation of conic shapes and sections in art and architecture. For that reason, I can't write an answer for you, but I'll show you how to write it.

The conical sections can be seen in structures that assume one of the shapes considered conical. These formats are easy to identify, especially in architecture, where they are very popular. These shapes can be classified as Parabola, Circle, Ellipse, and Hyperbole

In this case, to write your answer, you should search for architectural works or works of art that present one of these types of conic sections and show how the use of this format is important for these works.

Some examples of works that use conic sections are:

  • Parabola: Eiffel Tower.
  • Circle: Farmer's Cottage Deluxe Summer House
  • Ellipse: Tycho Brahe Planetarium.
  • Hyperbole: McDonnell Planetarium

More information:

brainly.com/question/2285436

8 0
2 years ago
Every windows service has the 3 start types what are those service types?
spayn [35]

Answer:

You can stop, pause, start, delay start, or resume each service as appropriate. You can also modify the start mechanism (Manual or Automatic) or specify an account. Windows Services broadly fall into three categories depending on the actions and applications they control: Local Services, Network Services and System.

5 0
2 years ago
What do you think of my profile picture
Gnom [1K]

ayo it's pretty sweet lma.o.

8 0
3 years ago
Read 2 more answers
Keith would like to compare data he has collected from research. The data includes the electrical output
liberstina [14]

Answer: my test says line graph soooo….

Explanation: if its what the test says

4 0
2 years ago
Josh wrote the following e-mail to his co-worker. PLEASE HELP QUWICK
Vedmedyk [2.9K]

Answer:

Answer choice 4

Explanation:

If Josh sends an e-mail to his... co-<em>worker</em>.... wouldn't that be... <em>work</em>place communication?

3 0
3 years ago
Read 2 more answers
Other questions:
  • QUESTION : John travels a lot and he needs to access his documents and services on the go. Which of these technologies allows hi
    15·1 answer
  • When an architect designs a building, what visual design elements could be used to help capture a viewer’s attention? A) The use
    5·2 answers
  • A set of communication rules for the computer to follow is called, what?
    10·2 answers
  • Type the correct answer in the box. Spell the word correctly. What aspect should you consider before adding pictures to a docume
    7·2 answers
  • Două numere a și b sunt numite generatoare ale unui număr natural n dacă a∙b+[a/b]=n, unde s-a notat cu [c] partea întreagă a nu
    7·1 answer
  • Describe the following types of data hazards. RAW WAR WAW
    13·1 answer
  • Similarly, the Windows server OS can run regular workstation applications such as MS Office or Adobe Photoshop. Why is this a ba
    5·1 answer
  • Cual es la importancia de aplicar los pasos en el modelo de diseño en las actividades académicas?
    14·1 answer
  • Write two example use of relationships ICT
    11·1 answer
  • Which of the following offers more reliable antivirus protection? Question 43 options: A) antivirus software on user PCs B) anti
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!