2 - Arrays, Sorting and Searching
purpose of this assignment is to give you practice working with arrays,
passing them to functions, sorting, searching and reading and writing
this program you will read two files and store their contents in
arrays. You will sort both arrays, and then search an array
for each element of the second array.
- Open two input files and one output file.
- Read in these two files and store their contents in 2
arrays of strings. Do not use a vector.
- Sort both arrays using either a selection sort, bubble sort or an
insertion sort. Use the same sort function for
sorting both arrays. Do not use the STL sort algorithm or
- Search the dictionary
array for each keyword.
If the keyword is not present in the dictionary array,
write a message to the output file that the keyword is not
found in the dictionary
(see sample output below). Count the number of keywords not found.
You will print this number at the end of the program.
Required console output
Number of keywords not found = ??
<= the number is between 20 and 30
Required file output (corrected 10/4/17)
|keyword not found: alignas
keyword not found: alignof
keyword not found: and_eq
keyword not found: asm
keyword not found: bitand
keyword not found: bitor
keyword not found: char16_t
keyword not found: char32_t
keyword not found: compl
keyword not found: const_cast
You must include at least two additional functions:
- a sort function
- a binary search function that looks for
each keyword in the
dictionary array. You may use a function that is similar to
the one that was presented in class. You may not use the STL
binary search algorithm.
- Place the function definitions below main() and function prototypes above
string class has less than, greater than, and equal operators (that's
<, >, and ==). You'll find those quite useful
- Try working with small dictionary and small
keyword files while you are developing your code. The logic
the same for a small file as it would be for large files. It
will be easier to debug your code with smaller files. After
get it working, switch over to the larger files.