Question
Using Vectors to Process an Array of Numbers Continuing with the first exercise, write a program to read in any number of real numbers from
Using Vectors to Process an Array of Numbers Continuing with the first exercise, write a program to read in any number of real numbers from the command line, using a vector to save such numbers, and printing them out afterwards. Following this scan the vector and determine the smallest number and build a new vector of size N-1 removing one of the smallest numbers. The following shows a sample of inputs and outputs:
$./lab4 88 62.4 5 6 8 5 92.1 63.12 Original array :
Numbers[0] : 88
Numbers[1] : 62.4
Numbers[2] : 5
Numbers[3] : 6
Numbers[4] : 8
Numbers[5] : 5
Numbers[6] : 92.1
Numbers[7] : 63.12
New array with smallest element removed :
Numbers[0] : 88
Numbers[1] : 62.4
Numbers[2] : 6
Numbers[3] : 8
Numbers[4] : 5
Numbers[5] : 92.1
Numbers[6] : 63.12
Hint: your code could look like the following:
// lab4.cpp #include |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started