subject

Run the program and observe the output to be: 55 4 250 19. Modify the numsInsert function to insert each item in sorted order. The new program should output: 4 19 55 250. #include
#include
using namespace std;
void numsInsert(vector& numsList, int newNum) {
unsigned int i;
for (i = 0; i < numsList. size(); ++i) {
if (newNum < numsList. at(i)) {
// FIXME: insert newNum at element i
break; // Exits the for loop
}
}
// FIXME: change so executes if higher number NOT found
// Change "true" to "i == ??" (determine what ?? should be)
if (true) { // No higher number was found, so append to end
numsList. push_back(newNum);
}
}
void numsPrint(const vector& numsList) {
unsigned int i;
for (i = 0; i < numsList. size(); ++i) {
cout << " " << numsList. at(i) << endl;
}
}

int main() {
vector numsList;
numsInsert(numsList, 55);
numsInsert(numsList, 4);
numsInsert(numsList, 250);
numsInsert(numsList, 19);
numsPrint (numsList);

return 0;
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:30
Hassan is writing his master’s thesis, which is a thirty-page document. he received some feedback from his professor in the form of comments, but does not see where the comments are. what is the fastest way for hassan to find the feedback?
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
As with any small island country, cuba has fewer natural resources than countries such as brazil. this affects their economy in that cuba a) exports only manufactured products. b) exports more products than it imports.. c) must import more products than it exports. d) has imposed trade barriers against the united states.
Answers: 3
question
Computers and Technology, 23.06.2019 07:30
What key should you press and hold to select and open multiple files at one time? enter alt control esc
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
Which finger presses the h key on the keyboard? index finger on the left hand pinky finger on the right hand index finger on the right hand thumb on the left hand
Answers: 1
You know the right answer?
Run the program and observe the output to be: 55 4 250 19. Modify the numsInsert function to insert...
Questions
question
Computers and Technology, 11.02.2021 14:00
question
Social Studies, 11.02.2021 14:00
question
Mathematics, 11.02.2021 14:00
question
Mathematics, 11.02.2021 14:00
question
English, 11.02.2021 14:00
question
Mathematics, 11.02.2021 14:00