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 10:00
Businesses allocate resources for their best and most productive uses. the more a resource, the more costly it will be. a manufacturer that requires scarce and costly resources is likely to charge for its products.
Answers: 2
question
Computers and Technology, 22.06.2019 10:10
3. bob is arguing that if you use output feedback (ofb) mode twice in a row to encrypt a long message, m, using the same key each time, it will be more secure. explain why bob is wrong, no matter what encryption algorithm he is using for block encryption (15 points).
Answers: 3
question
Computers and Technology, 22.06.2019 13:00
Which option should u select to ignore all tracked changes in a document
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
Need asap write a short paper describing the history and differences between six sigma, waterfall, agile, and scrum models. understanding these models can give you a good idea of how diverse and interesting it development projects can be. describe what the rationale for them is and describe their key features. describe the history behind their development. at least 400 words
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, 04.10.2019 18:00
Questions on the website: 13722362