×
Log in to StudySoup
Get Full Access to C++ For Everyone - 2 Edition - Chapter 4 - Problem R4.15
Join StudySoup for FREE
Get Full Access to C++ For Everyone - 2 Edition - Chapter 4 - Problem R4.15

Already have an account? Login here
×
Reset your password

What do the following program segments print Find the answers by tracing thecode, not by

C++ for Everyone | 2nd Edition | ISBN: 9780470927137 | Authors: Cay S. Horstmann ISBN: 9780470927137 356

Solution for problem R4.15 Chapter 4

C++ for Everyone | 2nd Edition

  • Textbook Solutions
  • 2901 Step-by-step solutions solved by professors and subject experts
  • Get 24/7 help from StudySoup virtual teaching assistants
C++ for Everyone | 2nd Edition | ISBN: 9780470927137 | Authors: Cay S. Horstmann

C++ for Everyone | 2nd Edition

4 5 1 364 Reviews
14
0
Problem R4.15

What do the following program segments print? Find the answers by tracing thecode, not by using the computer.a.int n = 1;for (int i = 2; i < 5; i++) { n = n + i; }cout << n;b.int i;double n = 1 / 2;for (i = 2; i <= 5; i++) { n = n + 1.0 / i; }cout << i;c.double x = 1;double y = 1;int i = 0;do{ y = y / 2; x = x + y; i++;}while (x < 1.8);cout << i;d.double x = 1;double y = 1;int i = 0;while (y >= 1.5){ x = x / 2; y = x + y; i++;}cout << i;

Step-by-Step Solution:
Step 1 of 3

ENGR 121 11/21/2016 Spencer Kociba ● Statistics ○ Mean ■ Average of numbers ○ Standard deviation and variance ■ 2 ways of determining the spread of data ○ mode(x) ■ Identifies the most frequently occurring value ○ sort(x) ■ Sorts vector from minimum value to max value ○ median(x) ■ Finds the middle number in a vector ■ Note: to find the median of a set of data, sort it first then use the median function ○ Median Filtering ■ Size of a median filter is calculating the median of every n values in that size ■ function medFiltVec = medianNFilter(signal) ■ medFiltVec = signal; ■ for i = 2:length(signal)-1 ■ medFiltVec(i) = median(signal(i-1 : i+1)); ■ end ■ End ○ Outlier ■ A number much larger or smaller than the rest of the data set ● Must remove these numbers from the data set ■ Ex. vector x has a set of data values in it ■ Newx = x((x~=min(x))&(x~=max(x))) ● Searching and Sorting ○ idx=0 ■ For i=1:length(vec) ● If (vec(i)==key) ○ idx=i; ○ Break ● End ■ End ○ idx=[]

Step 2 of 3

Chapter 4, Problem R4.15 is Solved
Step 3 of 3

Textbook: C++ for Everyone
Edition: 2
Author: Cay S. Horstmann
ISBN: 9780470927137

The full step-by-step solution to problem: R4.15 from chapter: 4 was answered by , our top Engineering and Tech solution expert on 03/08/18, 08:39PM. Since the solution to R4.15 from 4 chapter was answered, more than 351 students have viewed the full step-by-step answer. This full solution covers the following key subjects: . This expansive textbook survival guide covers 10 chapters, and 515 solutions. C++ for Everyone was written by and is associated to the ISBN: 9780470927137. The answer to “What do the following program segments print? Find the answers by tracing thecode, not by using the computer.a.int n = 1;for (int i = 2; i < 5; i++) { n = n + i; }cout << n;b.int i;double n = 1 / 2;for (i = 2; i <= 5; i++) { n = n + 1.0 / i; }cout << i;c.double x = 1;double y = 1;int i = 0;do{ y = y / 2; x = x + y; i++;}while (x < 1.8);cout << i;d.double x = 1;double y = 1;int i = 0;while (y >= 1.5){ x = x / 2; y = x + y; i++;}cout << i;” is broken down into a number of easy to follow steps, and 112 words. This textbook survival guide was created for the textbook: C++ for Everyone , edition: 2.

Other solutions

Discover and learn what students are asking






Statistics: Informed Decisions Using Data : Estimating the Value of a Parameter
?State the properties of Student’s t-distribution.







People also purchased

Related chapters

Unlock Textbook Solution

Enter your email below to unlock your verified solution to:

What do the following program segments print Find the answers by tracing thecode, not by