Starting from:

$20

Programming II Integer set 1

Assignment: Create three sets from lists of integers found in files i061.dat, i062.dat, and i063.dat. Find set I the intersection of set 1 and set 2. Find set U the union of set 2 and set 3. Find set D the difference of set U - set I. Print results in file o06.dat as shown in Figure 2. Prohibition: Use of the C++ Standard Template Library is prohibited in the implementation of this project. Program Files: Project 6 consists of files p06.cpp, List06.h, Set06.h, and p06make. Project file names are exactly as given. Failure to employ the foregoing names will result in a score of zero (0) for this project Project files must be stored in the root directory of your student account. Failure to store project files in the root directory of your student account will result in a score of zero (0) for this project. File Description p06.cpp File p06.cpp contains functions that process command line arguments and direct set operations. List06.h File List06.h contains all that is required for template <class T class List { … }; Class List implements a list of integers by dynamically allocating individual elements of a list. Each element contains an element of type T. Elements are placed in a doubly linked circular list with a sentinel after the element containing the largest value. Elements are stored in ascending order. Elements are dynamically allocated when needed and discarded after they are no longer required. Elements of the list are unique. Class List is the base class. Set06.h File Set06.h contains all that is required for template <class T class Set : public List { … };. Class Set is derived from class List. Set operations include insertion, deletion, union, intersection, and difference, and printing. p06make File p06make contains instructions for creating executable file p06. Instructions in file p06make are accepted by the UNIX utility make. Command Line: Project 6 can be invoked with up to four program parameters. The first three program parameters are the names of the input files containing sets 1, 2 and 3. The fourth program parameter in the name of the output file where results are recorded. Sample command lines together with corresponding actions by program p06 are shown below. Boldfaced type indicates data entered at the keyboard by the user. $ p06 Enter the name of input file 1: i061.dat Enter the name of input file 2: i062.dat Enter the name of input file 3: i063.dat Enter the output file name: o06.dat $ p06 i061.dat Enter the name of input file 2: i062.dat Enter the name of input file 3: i063.dat Enter the output file name: o06.dat $ p06 i061.dat i062.dat Enter the name of input file 3: i063.dat Enter the output file name: o06.dat $ p06 i061.dat i062.dat i063.dat Enter the output file name: o06.dat $ p06 i061.dat i062.dat i063.dat o06.dat Input files: Input files contain a list of integers. Unique integers in the list are the elements of a set. Sample data is given in below. Input file 1: 1 2 3 4 Input file 2: 2 4 6 8 Input file 3: 1 3 5 7 Output files: The format of the output file is shown in Figure 2. Data shown in Figure 2 is produced by Program p06 given input files shown above. Figure 2. Output file format: set 1={1,2,3,4} set 2={2,4,6,8} set 3={1,3,5,7} set I={2,4} set U={1,2,3,4,5,6,7,8} set D={1,3,5,6,7,8}

More products