I have a small C++ program due in 48 hours from now and was wanting to seek some assistance. It will be submitted and graded on a Linux machine. Here is the project description: Write a C++ program...

I have a small C++ program due in 48 hours from now and was wanting to seek some assistance. It will be submitted and graded on a Linux machine. Here is the project description:


Write a C++ program that performs the tasks described below.
If there is just 1 command-line argument and it is-hwyou should simply printhello worldand then exit(0).
Otherwise the program should expect 2 cmd-line args.The first arg will be an integer which will be the number of pages of memorythat the program should obtain via mmap.The second arg will be a filename. The file will contain one cmd per line.Each cmd should be interpreted by the program. Lines that begin with # arecomments and should be skipped; empty/blank lines should also be skipped.
Initialize the mmap'd space with a set of node structures:
struct node {long int val;struct node *next;};
where val is initialized to -1, and next to NULL.
The commands to interpet are:
isrt valplace val into the next open node in the mmap'd space and alsohook it into the linked list sorted by increasing val's(for duplicate value, silently ignore the cmd)(do NOT print anything if the cmd is successful)(if out of space, give an error msg and exit(-1); )
delt valremove the item from the linked list and then reset the node'sval to -1 and next pointer to NULL(if the val is not in list, silently ignore the cmd)(do NOT print anything if the cmd is successful)
prtt some textprints the text on a single line, e.g.:prtt harry potterwould print:harry potter
prtuprints vals sequentially from the beginning of the mmap'd space;they are NOT to printed in sorted order; skip those with val -1print each val and its next pointer (using %p) on a single lineseparated by two spaces
prtsprints sorted list by following the next pointers;print each val and its next pointer (using %p) on a single lineseparated by two spaces
blnkprints blank line
Feb 18, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here