Starting from:

$29.99

lab2: Linked List Template

COSC2430 lab2: Linked List Template
1. Introduction
You will implement a C++ program to add and remove objects in a linked list. The purpose of this lab is to
get students familiar with Linked List operations and type template. Please name the folder on the server as
“lab2”.
2. Input files
- The first line of the input will contain a string, this string will either be “string”, “integer”, or “character”
this will indicate the data type of the data that will be added to the linked list, each input file only
contains a single data type.
- The second line of the input will tell you how to add data into the linked list, it will either be “head” or
“tail”. If its “head” that mean all the data should be added at the head for this input file, and if its “tail”
that mean all the data should be added at the tail for this input file.
- Each element will be on its own line.
- Beside the data to be added to the linked list, there will be two remove operation, it will either be
“remove head” or “remove tail”. If its “remove head” that mean removing the first element of the linked
list, and if its “remove tail” that mean removing the last element of the linked list. “head”, “tail”,
“remove” are keywords and will never appear as a data to be added to the linked list.
- There will be no empty lines
- There might be empty input file, in this case the output should be empty.
3. Output files
- The output file should display every element of your linked list.
- Each element will be separated by a space (note there is no extra space at the end of the output).
4. Examples
input1.txt
ans1.txt
string
head
world
digital
remove tail
hello
print
remove tail
print hello
input2.txt
ans2.txt
 input3.txt
ans3.txt
5. Turn in your lab assignment
lab2 needs to be turned in to our Linux server, follow the link here
https://rizk.netlify.app/courses/cosc2430/2_resources/
Make sure to create a folder under your root directory, name it “lab2” (case sensitive), copy all your .cpp
and .h file to this folder, “ArgumentManager.h” need to be included as well.
PS: This document may have typos, if you think something illogical, please email TAs for confirmation.
2 0 15
char
head
c
remove tail
remove tail
h
w
o
p
e
remove head
remove tail
remove head
r
r o w
int
tail
23
2  
remove head
0
45
remove tail
15

More products