The purpose of this lab is to practice some string operations, to reinforce using functions, and to reinforce control statements from previous chapters.
The media server project is going well, however the volume of files exceeds what a person could reasonably click through one at a time. To practice an automated task your friend asks if it is possible to evaluate and sort thousands of files at a time without user intervention Your friend would like to see a report that demonstrates the number of files to evaluate, and the end result count in each repository Your file of media is here unsorted media.txt
Your program should:
Constraints:
Hint:
1. Add "unsorted_media.txt","movies.txt","music.txt","images.txt","error.txt" to the resource files folder
2. Use preprocessor directives to include input/output, file input/output, string variables, and manipulators
3. Declare string variables for each item in Task 1.1.
4. Declare int variables to hold a count value for each line in Task 1.1.
5. Declare a single string variable to hold the current item from the input stream
6. Separate Task 1 from Task 2 by pressing ENTER on your keyboard. This provides a single line of whitespace in your code
1. Design a function to count each entry in file location.
2. Design a function to determine the "format" of each item in the input file.
3. Design a function to sort the media from the input file to each output file
if (ext == "avi" || ext == "mkv" || ext == "mov" || ext == "mp4" || ext == "wmv")
mov_out << file << endl;
else if (ext == "flac" || ext == "m4a" || ext == "mp3" || ext == "wav" || ext == "wma")
mus_out << file << endl;
else if (ext == "bmp" || ext == "gif" || ext == "jpg" || ext == "png" || ext == "tiff)
img_out << file << endl;
else
err_out << file << endl;
4. Design a function to print out the final report. It should output as the second example below.
5. Declare additional functions as needed to handle items such as exiting the program, clearing the screen, or other tasks that you perform often.
1. Determine appropriate locations to comment your code.
2. Is there a confusing section of code?
3. Is there a maths operation?
4. Is there a control statement?
5. Is there a defined function?
6. You should not include "teaching comments to explain:
Sample Output: see image.