In this lab practice, you should write a program in C++ thatimplements insertion
ID: 3616312 • Letter: I
Question
In this lab practice, you should write a program in C++ thatimplements insertion sort.
Additional features of your program:
Add a command line option so that when the option isset:
a) Duplicated numbers are removed in the output file.
Test your program thoroughly, so that it can handle differentinput cases elegantly, consider cases such as (but not limitedto):
a) Input file does not exist or is an empty file;
b) Input file validation, what if it contains characterstrings instead of numbers (optional).
Explanation / Answer
please rate - thanks doesn't work for character strings, but the rest does work, for the character strings, since it's called file validation shouldthe program abort? sort the strings? are the strings words orsentences - I had too many questions #include #include #include using namespace std; void insertion_sort (int); void insertion_sort(int x[],int length) { int key,i; for(int j=1;jkey && i>=0) { x[i+1]=x[i]; i--; } coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.