oop代写 | 代写project | c++ | 代做lab | 数据结构代做 – CSC230 Lab 6

CSC230 Lab 6

c++ | oop代写 | 代写project | 代做lab | 数据结构代做 – 该题目是一个常规的oop的练习题目代写, 是比较典型的oop等代写方向, 这个项目是lab代写的代写题目

project代写 代写project


Goal : To familiarize with a live project on the usage of function and linked list, fstream, and eof().

While the due date is Mar 21, try your best to explore and finish the lab in class, and submit it on CANVAS.

In this lab, you are expected to write a program with the features explained below and name it as < YourName>Lab6.cpp file. Define a main function in this file, and define two more functions append () and search ().

Features

  • Write a program to append() and search() function using the supporting document attached – sample.txt file.
  • Read the contents from the input file – sample.txt.
  • Store SSN and the corresponding name (including both first name and last name) to a LinkedList.
  • Each row of the input file has a leading char, followed by a string of SSN, and first name and last name.
  • Note: Whenever YournameLab6.cpp reads one row from the file, it should store the SSN and the corresponding name (including both first name and last name) to a singly linked list.
  • After the whole input file is processed, the program prompts the user to type an SSN, then it will search the SSN in the singly linked list. If there is a match, the program prints out the index value of the node.
    • Suppose the first node has index value 0. For example,

jli$ ./a.out sample.txt Input a SSN: 766434955 Found at location 4

jli$ ./a.out sample.txt Input a SSN: 038249140 Found at location 8

In this lab, you can use fstream library to read file. An example code is listed as follows:

#include #include using namespace std;

int main(int argc, char* argv[]){ int x, y, z; fstream input(argv[1]); while(!input.eof()){ input >> x >> y >> z; } input.close(); }

If you do not remember how to read the contents from a file, refer to your lab implementation.

Hints & Requirements

  • The append() function MUST insert the node to the end of the list, NOT the beginning of the list or any middle position of the list.
  • The Node defined in the slides has only one user variable, val. You can define multiple variables inside one node. For example, you can define string SSN; and string name; inside the node.
  • Do NOT define any array in this lab. You do not need array in this lab.
  • search() function is optional. You can define a separate search() function to search a given SSN, or write a l oop inside the main() function doing the searching job.

Wrap up

When you’re done, jar three files to lab6.jar

jar cvf lab6.jar *

Submit lab6.jar to Canvas.

Make sure you logout before you leave!

If you cannot finish lab in class, please save all your files. Next time you login the computer in the lab, you can continue work on your files. Please save them before you logout. If you work in a Linux lab, please save the file to your machine. However, if you are working in the Mac lab, please save the file to a CLOUD. The Mac machine will erase everything you saved once you logout.