Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Requirements: NOT using any container classes defined in STL , implement all functions declared in tvector.h in a separate file called tvector.hpp . Note tvector.hpp
Requirements: NOT using any container classes defined in STL implement all functions declared in tvector.h in a separate file called tvector.hpp Note tvector.hpp is included in tvector.h You may used standard C IO libraries, as well as class libraries like string.Using the tag stdc write a Makefile pt and put it in the same folder with tvector.h tvector.hpp and driver.cpp The Makefile should compile the driver.cpp driver into an executable called projx Your program must be able to compile and run on the linprog machines as this is where TAs will test your code.Screen out compilation errors. One compilation error costs you pt You will automatically get pt if there are compilation errors. Write a variety of test cases to screen out crashing when running projx pt In judging your code, TAs will test on two different input files. If no crash on both test cases, you obtain the pt If your code crashes on both, you only obtain the pt if your Makefile is correct. Therefore the crash like segmentation fault costs you not only these pt but also the pt in the main programming part even if you write a few functions correctly. If your program crashes on one of two test cases, then you obtain ptpt but the TA will look at each of your function and give you points for the functions you correctly implemented. Important: make sure your code does not crash on the given driver.cpp test case. Obtain your result by running driver.cpp Debug until you get the same result as the provided file driveroutput.txt Submission:Tar up your tvector.hpp and Makefile into a single tar archive and submit online via Canvas, in the "Assignments" section.To do that, copy these two files to a separate folder. Use the linux command "tar zcvf tarfilename.tar pathtofolder in which pathtofolder is the folder which contains only these two files vectorhpp and Makefile and tarfilename.tar should be lowercase: lastnamefirstnameptar. Example: to tar a folder whose path is mypathtofolder and generate my submission, I will use this command "tar zcvf malloryxianptar mypathtofolder You should replace with yours for the tar file and path to folder. Use the Assignment link to submit this tar file.To check if you tar your programs correctly, you can use command "tar tf tarfilename.tar" to see if the two files are in your tar file already.Information:Define all of the functions for these classes in the file tvector.hppAlways make sure there is ROOM in the array before inserting a new item. If you ever try to insert data, and the array is full to capacity then increase the capacity by doubling itDo NOT change any of the prototypes or member data declarations in the tvector.h file at all. All current declarations have the intended prototypes, and they will need to work with my main programs.Clean up dynamic memory in appropriate places and do not leave any memory leaks.tvector class templateThe member data of this class consists of a pointer to a dynamically managed array, along with tracking variables for the capacity and the size. Note that the capacity refers to how much space is currently allocated, and size refers to how many data items are currently stored.There is a dummy variable of type T that can be used for errorchecking situations. Specifically, whenever a function is to return a stored data item but the container is empty, return a reference to the dummy object. Whether you should return the dummy object itself or a reference to it depends on how the function is declared.A static constant called SPARECAPACITY is in the member data so that it can be used to add some extra capacity when constructing vector objects.Iterators The small class called TVectorIterator is a helper class that can be used in conjunction with the vector class. This is a common feature used in container classes like this. The purpose of an iterator is to provide a common and nonimplementationspecific way of traversing a container, so that mulitple containers could potentially use common algorithms like sorting and searching functions, for example For the iterator class in this assignment, here is a brief sample use
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started