Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[c++] Use of the C++ Standard Template Library is prohibited in the implementation of this. using command line arguments. The first program parameter is the

[c++] Use of the C++ Standard Template Library is prohibited in the implementation of this.

using command line arguments. The first program parameter is the input file name. The second parameter is the output file name.

input file named i03.dat contains values of for code fragments 3. The program reads the input file and produces an output on an output file. The input file consists of a sequence of integers. Integers are separated by white space. White space is one or more characters from the set that includes a blank character, a newline character, or a tab character.

example of the input file: 0 1 2 3 4 5 6 7 8 9 10

example when running program:

Enter the first input file name: i03.dat

Enter the output file name: o03.dat

the program will Print your results in the output file.

1. Print a line identifying the code fragment. For example, this code fragment is identified as Code Fragment 3

2. Put your output in three columns. Label the first column n, the second column Analytical and the third column Empirical. Produce values of () for each code fragment. One line is printed for each value of read. Write the value of in the column labeled n. Write the value of () computed by the designated analytical function, af3, in the column labeled Analytical. Write the value of () computed by the selected empirical function, ef3, in the column titled Empirical. Right justify and align data produced in rows with their corresponding columns.

image text in transcribed

example output using the example fragment 0:

image text in transcribed

af3 function

int af3(int n){

return 3 * n + pow(2, n) + 4; // remember to put #include

}

ef3 function

int ef3(int n)

{

int t = 0;

int sum = 1; t++;

int i=0; t++;

while(i

sum = sum * 2; t++;

i++; t++;

} t++;

while(sum > 0){ t++;

sum--; t++;

}

return t;

}

int sum 1, for (int a=0;a0)sum Figure 1. Code Fragment 3 int sum 0 for (int i=0;i<><>

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

Database And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 1 Lncs 8055

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013 Edition

3642402844, 978-3642402845

More Books

Students also viewed these Databases questions