BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

C语言代写 | CIS 212 Project 5 Creating and using an ADT

C语言代写 | CIS 212 Project 5 Creating and using an ADT

这个project是用C语言创建StringList ADT的实现并进行测试
CIS 212 Project 5  
Creating and using an ADT  
Due at 8:00pm on Monday, 11 May 2020  
This project requires you to create an implementation of a StringList ADT and to test that  
implementation by creating a program that prints out the lines read from standard input in  
reverse order on standard output.  
1
Requirements  
1.1stringlist.c  
You are to implement the StringList ADT defined by the following interface, stringlist.h:  
#
#
/
ifndef _STRINGLIST_H_  
define _STRINGLIST_H_  
*
*
*
interface to a StringList ADT  
/
#
define DEFAULT_CAPACITY 50L /* default initial capacity */  
typedef struct stringlist StringList;  
/* define synonym */  
const StringList *StringList_create(long capacity); /* use default if 0 */  
struct stringlist {  
void *self;  
/
*
*
*
destroy the StringList, invoking free() on each element  
void (*destroy)(const StringList *sl);  
/
/
*
*
*
*
append string (allocated from the heap) to the StringList  
grow the capacity of the list, if necessary  
/
/
int (*append)(const StringList *sl, char *s);  
retrieve string at `index’ from the StringList  
int (*get)(const StringList *sl, long index, char **sptr);  
/
/
*
*
*
*
*
*
*
return the number of strings in the list, N;  
legal indices: 0 <= index < N  
/
long (*size)(const StringList *sl);  
}
#
;
endif /* _STRINGLIST_H_ */  
You must create the file stringlist.hin your project 5 directory, and enter the above text.  
1-  
CIS 212 Project 5  
1.2 reverse.cusing the StringList ADT  
You are to write reverse.c; this code, when linked with stringlist.o, reads each line  
from standard input, appending a copy of that line to a StringList. After detecting end of file on  
standard input, it prints out the lines stored in the StringList from last to first.  
The pseudocode for reverse.cis as follows:  
include necessary files  
main()  
create a StringList  
if failure  
print error message  
terminate program  
while there is a next line  
duplicate the line on the heap  
append the duplicate to the StringList  
if append fails  
print error message  
cleanup and terminate  
set N to number of strings in the StringList  
for i = N-1 downto 0  
get string at index i  
print string  
destroy the StringList  
2
Starting files  
In Canvas, in Files/Projects, you will find a gzipped tar archive named P5start.tgz; this file  
contains the following files:  
small.in– a file that contains a small number of lines as input to reverse.  
medium.in– file that contains a medium number of lines as input to reverse.  
large.in– file that contains a large number of lines as input to reverse  
small.out– the correct output that should result when executing  
./reverse <small.in  
medium.out– the correct output that should result when executing  
./reverse <medium.in  
large.out– the correct output that should result when executing  
./reverse <large.in  
template.c– a template file that you must rename to stringlist.cand flesh  
out with your implementation of a StringList.  
2-
CIS 212 Project 5  
3
You will submit your solutions electronically by uploading a gzipped tar archive2 via Canvas.  
Submission1  
Your TGZ archive should be named <duckid>-project5.tgz, where <duckid>is your  
3
duckid” . It should contain your files stringlist.c, reverse.c, and your Makefile; it  
should also contain a file named report.txt; this file should contain your name, duckid, the  
names of any classmates who helped you and what assistance they provided, and the current  
state of your solution. Do not include any other files in the archive.  
1 If you do not follow these submission instruction, I will NOT mark your submission and you will receive a 0 for  
the project.  
2 See section 7 of Canvas/Files/Projects/P1Handout.pdf for instructions if you do not remember how to create a  
gzipped tar archive. Obviously, the filenames used for this project will be different.  
3 Your duckid is your uoregon.edu email address, without the @uoregon.edu; for example, my duckid is jsventek. It  
is most particularly not your UOID, which is a 9-digit number that starts with “95”.  
3-
CIS 212 Project 5  
Grading Rubric  
Your submission will be marked on a 50 point scale. Substantial emphasis is placed upon  
WORKING submissions, and you will note that a large fraction of the points are reserved for this  
aspect. It is to your advantage to ensure that whatever you submit compiles, links, and runs  
correctly. The information returned to you will indicate the number of points awarded for the  
submission.  
You must be sure that your code works correctly on the virtual machine under VirtualBox,  
regardless of which platform you use for development and testing. Leave enough time in your  
development to fully test on the virtual machine before submission.  
The marking scheme is as follows:  
Points  
5
Description  
Your report – honestly describes the state of your submission  
reverse  
reverse.c successfully compiles  
reverse.c compiles with no warnings  
The link phase to create reverse with my stringlist.o is successful  
The link phase to create reverse with my stringlist.o is successful with no warnings  
reverse works correctly with small.in  
1
1
1
1
1
1
1
2
3
3
6
reverse works correctly with medium.in  
reverse works correctly with large.in  
reverse works correctly with unseen medium-sized input file ( 104)  
6
reverse works correctly with unseen large-sized input file ( 10 )  
valgrind reports no memory leaks or errors  
The code could have worked with minor modification to the source.  
StringList  
2
1
1
2
2
5
stringlist.c successfully compiles  
stringlist.c compiles with no warnings  
Link with my reverse.o is successful  
The resulting program works correctly with medium.in  
The resulting program works correctly with large.in  
valgrind reports no memory leaks or errors  
The code could have worked with minor modification to the source.  
1
1
Note that:  
Your report needs to be honest. Stating that everything works and then finding that it  
doesn’t is offensive. The 5 points associated with the report are probably the easiest 5  
points you will ever earn as long as you are honest.  
The points for “could have worked” is the maximum awarded in this category; your  
mark in this category may be lower depending upon how close you were to a working  
implementation.  
-1-  
bestdaixie

评论已关闭。