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.
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
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fcedac035-2d99-437d-b677-714f6be3f07f%2F301113d4-5f38-4659-bfd3-521a213ed2f3%2F4so99s_processed.jpeg&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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.Recommended textbooks for you
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
![Systems Architecture](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning