WorkArea Instructions Write a code block that reads (from user input) a list of 5 integers and stores them in a vector. Then, the block outputs the two smallest integers in the list, in ascending order. #include #include using namespace std; int main() { / Your code block should be here. / return 0; } Example: If the input is: 10 5 3 21 2 The output should be: 23 Hint: Make sure to initialize the smallest and second smallest integers properly. Additional Notes: Regarding your code's standard output, CodeLab will check for case errors but will ignore whitespace (tabs, spaces, newlines) altogether.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 23SA
icon
Related questions
Question
ors
WorkArea
Instructions
Write a code block that reads (from user input) a list of 5 integers and stores them in a vector. Then, the block outputs the two smallest integers in the list, in
ascending order.
#include <iostream>
#include <vector>
using namespace std;
int main() {
/* Your code block should be here. */
}
return 0;
Example:
If the input is:
10 5 3 21 2
The output should be:
23
Hint: Make sure to initialize the smallest and second smallest integers properly.
Additional Notes: Regarding your code's standard output, CodeLab will check for case errors but will ignore whitespace (tabs, spaces, newlines) altogether.
?
MacBook Air
Transcribed Image Text:ors WorkArea Instructions Write a code block that reads (from user input) a list of 5 integers and stores them in a vector. Then, the block outputs the two smallest integers in the list, in ascending order. #include <iostream> #include <vector> using namespace std; int main() { /* Your code block should be here. */ } return 0; Example: If the input is: 10 5 3 21 2 The output should be: 23 Hint: Make sure to initialize the smallest and second smallest integers properly. Additional Notes: Regarding your code's standard output, CodeLab will check for case errors but will ignore whitespace (tabs, spaces, newlines) altogether. ? MacBook Air
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning