Description
Requirements
In this lab, you are required to write a program that reads a file containing A numbers and writes a sorted output to a file. The number of lines in the file is not going to be more than 100 lines. The problem with the file is that students submit A numbers with all sorts of formats. Below are some examples of A numbers: >> cat input.txt A1001.txt A00010001.txt A33333 34222 a3333.txt Since students use different formatting instructions, it is extremely difficult to sort.
Your job is to write an insertion sort that can sort this input file based on A numbers. According to BCIT and COMP2510, a proper A number format is the following: A0XXXXXXXXX.txt It starts with a capital A, followed by 0. Then, there are 7 numeric numbers followed by “.txt”. However, the input file contains A number formats that are not consistent with the above specification.
Dropping A, lower case a, no .txt, not leading 0’s etc. Unfortunately, your program must still be able to sort it. A1001.txt is actually A00001001.txt, but the student didn’t bother to include leading 0’s. 34222 is A00342222.txt, but the student didn’t include A, leading 0’s and .txt. Your job is to sort this file in an ascending order even with such data not following the format. >> cat output.txt A1001.txt a3333.txt A00010001.txt A33333 34222 You must use a insertion sort to implement the sorting algorithm.
The Below are additional specifications of this lab. 1. The first argument is the intput file, and the second argument is the output file name. The run command will be ./