Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ program running on visual studio. Here's the program: /* file: binary_timing.cpp lab 10 exercise program to demonstrate to the student how much faster it

C++ program running on visual studio.

image text in transcribed

Here's the program:

/* file: binary_timing.cpp lab 10 exercise program to demonstrate to the student how much faster it is to write (and read) a data file in binary than in ascii. */ #include  #include  #include  #include  using namespace std; const int SIZE=64*1048576; // 64 * 1024*1024, 64 MegBytes void initialize_dat(char dat[], int size); void write_ascii_data(const char dat[], int size); void read_ascii_data(char dat[], int size); /* void write_binary_data(const char dat[], int size); void read_binary_data(char dat[], int size); */ int main( ) { char *dat = new char[SIZE]; if (! dat) {cerr (dat[i]); if (i%16==15) ofs > val; // read number into an integer dat[i] = static_cast(val); // convert it to a char. if(i%(1024*1024)==0) {cout   Part 2. Reading and writing binary data is much faster than reading and writing text data. Here is a program which does the following: a. creates a chan array 64 MB long ke 8-bit pixels, for example b, initialize it to random values between -128 and 127 c. writes the values to a data file as (text) integer values (like we have done with our PGM images ew seconds, double or quadruple the size of the array.) s program and time how long it takes to run. (I akes less than a un Then, write function to wri e out and read back in the same data in binary format. Run your program and time how long it take to run. Calculate approximately how much fast it is to read and write binary and what the difference in size is between the ascii file and the binary file. Add a few lines to your binary imput output notes.xt file giving the comparisons. Then estimate how long it would take to read a 10 GB ascii PGM, and how long it would take to read the equivalent 2.5 GB binary PGM Hereoans my Solution. if you get snick. Name your output binary timing.cpp

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

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

=+Are there shop stewards?

Answered: 1 week ago