Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Data structure in C++ help needed! Here's the assignment ____________________________________________________________ Here's the code you need to edit, you may only use these three headers! I

Data structure in C++ help needed!

Here's the assignmentimage text in transcribed

____________________________________________________________

Here's the code you need to edit, you may only use these three headers!

image text in transcribed

I do rate the answer, so please answer it as accurate as possible

2) Required function: void unzip_file(const std::string& filename) You get to work on your program to obfuscate a file and write a function named "unzip_file." Your idea is to treat a file as blocks of 4 bytes of data and reorder these blocks so that to the world, this looks like nothing more than random data. To do this, you should open the file in binary mode and move every even positioned "block" to the end of the file, maintaining their order and leaving no space between each block. At the end, all odd positioned blocks are in increasing order, and all even positioned blocks should be in increasing order, where all even positions follow all odd positions. This output should be stored in a new file with the same name as the original file, but with the added suffix "-unzipped". EXAMPLE: Suppose you have a 32-byte file named "test" as follows (in hex): 0102030405060708091011121314151617181920212223242526272829303132 If we treat everything in the file groups of 4 bytes, we can view the file as the following 8 blocks: [ 1 2 3 10 4 1 5 ] 6 ] 7 j 8] 0102030405060708091011121314151617181920212223242526272829303132 After running your function unzip file on this file "test", the blocks should be reordered as follows and the resulting data should be written to a file named "test-unzipped": [ 1 3 5 7 2 4 1 6 8 1 0102030409101112171819202526272805060708131415162122232429303132 To accomplish this Open the file with the given filename for input in binary mode. Read the entire file contents (you may want to compute the file size as well). * Manipulate the data write the output data to a file with the same name as the input file, but with the added suffix"-unzipped" Note: you should not modify the original file when doing this

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Is the current human resources management system obsolete?

Answered: 1 week ago