C Programming only. Part 1: (18 points) You will create a program (part1.c) which will open two files whose name will be passed in the command line (example files: File1Dos.txt, File2.Dos.txt or...


C Programming only.


Part 1: (18 points)

You will create a program (part1.c) which will open two files whose name will be passed in the command line (example files: File1Dos.txt, File2.Dos.txt or File1Unix.txt. File2Unix.txt depending on your OS). You will merge the two files into one (FileMerged.txt) by sorting them.


The merging will happen in the same way as in a mergeSort, i.e. you will read the two current elements, and then pick the smallest and write it to the output file.


The format of File1*.txt, and File2*.txt is


NameOfFileInOneWord numberOfElements


Elements separated by spaces sorted in increasing order.


Your FileMerged.txt will have the same format, i.e. the name, total number of elements will be on the first line, then you will have one line with all the elements sorted in increasing order.


You will use a dynamically allocated array for each of the sequence of elements, i.e. you will have one array to put the content of File1*.txt, one for File2*.txt, and one for merged result . You will create all the functions, i.e. no call to any sorting C library.


Your program will be able to work with any 2 files of that format which is passed to the command line.


Part2: (32 points)

You will create a program (part2.c) which will use a double linked list which will contain integers. You will then create a menu with a loop which will have the following options:


Print the linked list


Insert an element in position x i.e. inserting 3 in position 1 will mean


2->3->4 will become 3->2->3->4


Delete an element by giving it a position number i.e. deleting element 2 from list will mean


2->3->4 will become 2->4


Rotate the linked list by a number, i.e. rotating by 1 means


2->3->4 will become 3->4->2


Rotating by 2 means


2->3->4 will become 4->2->3


The rotation will always be in the same direction.


Your program will use*:


Structures


Pointers to structures


Function pointers for all options of the menu.


I recommend you use one structure for the linked list and another one for passing the arguments to the functions..


I recommend you validate your rotation and your positions, i.e. positive integers, less than the number of elements in the list.


Your structures will be in a file called structPart2.h.


You may use any code that I have given you in any module..


Make sure to look at the list of penalties at the bottom of the assignment.


*: when I say that your program shouldUSEsomething, it means that if I remove it, your program will either not compile, or not work. Having it listed but useless is not enough.





May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here