Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 7, Problem 4PP
Program Plan Intro
Program Plan:
- Include the appropriate headers into program.
- Declare and define the constant variable “LEN”.
- Declare the appropriate functions.
- Define the “main()” function.
- Declare the array variable “arr[]” in type of double.
- Declare the variables “stdDeviation” and “avg” in type of double.
- Declare the variable “ans” in type of character.
- Using “do…while” loop, prompt the user for array values.
- Call the function “stdDev()” which passes array and size of array and store the result in “stdDeviation”.
- Prompt and get the sentinel value from user.
- Check the loop with condition for sentinel value.
- Return “0” to called function.
- Define the function named “stdDev()” which passes the arguments “arr[]” in type of character and “size” in type of integer.
- Declare and initialize the “sumSquares” in type of “double”.
- Call the function “average()” which passes array and size of array as arguments and stores the result in “avg” variable.
- Using “for” loops, calculate the summation value.
- Return the square root of summation value.
- Define the function named “average()” which passes “arr[]” and “size” as arguments.
- Declare and initialize the “sum” in type of “double”.
- Using “for” loop, calculate the total of array values.
- Return the average of array values.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
the value of factor(P/F,i,10) can be found by getting the factor values for(P/F,i,4) and(P/f,i,6)and adding it to
Let R and S be the sets :R = {x eZ | x is divisible
by 2} S = {y e Zly is divisible by 3} then RNS =
%D
true O
False O
use py only
Chapter 7 Solutions
Problem Solving with C++ (10th Edition)
Ch. 7.1 - Prob. 1STECh. 7.1 - In the array declaration double score(5); state...Ch. 7.1 - Identity any errors in the following array...Ch. 7.1 - What is the output of the following code? char...Ch. 7.1 - What is the output of the following code? double a...Ch. 7.1 - What is the output of the following code? int i,...Ch. 7.1 - Prob. 7STECh. 7.1 - Suppose we expect the elements of the array a to...Ch. 7.1 - Prob. 9STECh. 7.1 - Suppose you have the following array declaration...
Ch. 7.2 - Consider the following function definition: void...Ch. 7.2 - Prob. 12STECh. 7.2 - Write a function definition for a function called...Ch. 7.2 - Consider the following function definition: void...Ch. 7.2 - Insert const before any of the following array...Ch. 7.2 - Write a function named outOfOrder that takes as...Ch. 7.3 - Write a program that will read up to ten...Ch. 7.3 - Write a program that will read up to ten letters...Ch. 7.3 - Following is the declaration for an alternative...Ch. 7.4 - Prob. 20STECh. 7.4 - Write code that will fill the array a (declared...Ch. 7.4 - Prob. 22STECh. 7 - Write a function named firstLast2 that takes as...Ch. 7 - Write a function named countNum2s that takes as...Ch. 7 - Write a function named swapFrontBack that takes as...Ch. 7 - The following code creates a small phone book. An...Ch. 7 - There are three versions of this project. Version...Ch. 7 - Hexadecimal numerals are integers written in base...Ch. 7 - Solution to Programming Project 7.3 Write a...Ch. 7 - Prob. 4PPCh. 7 - Write a program that reads in a list of integers...Ch. 7 - Prob. 6PPCh. 7 - An array can be used to store large integers one...Ch. 7 - Write a program that will read a line of text and...Ch. 7 - Write a program to score five-card poker hands...Ch. 7 - Write a program that will allow two users to play...Ch. 7 - Write a program to assign passengers seats in an...Ch. 7 - Prob. 12PPCh. 7 - The mathematician John Horton Conway invented the...Ch. 7 - Redo (or do for the first time) Programming...Ch. 7 - Redo (or do for the first time) Programming...Ch. 7 - A common memory matching game played by young...Ch. 7 - Your swim school has two swimming instructors,...Ch. 7 - Your swim school has two swimming instructors,...Ch. 7 - Prob. 19PPCh. 7 - The Social Security Administration maintains an...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- There are 2016 passengers about to board a plane, numbered 1 through 2016 in that order. Each passenger is assigned to a seat equal to his or her own number. However, the first passenger disregards instructions and instead of sitting in seat number 1, chooses and sits down in a randomly chosen seat. Each subsequent passenger acts according to the following scheme: if their assigned seat is available, they will sit there; otherwise, they will pick at random from the remaining available seats and sit there. What is the probability that the 1512th passenger ends up sitting in their assigned seat? A. 1/2016 B. 1/2 C. 5/8 D. 3/4 E. None of the abovearrow_forwardc. If k = d, then p(n) = Ⓒ(nk).arrow_forwardAs an investor, I always check the stock market in order to find good companies to invest in. Recently, I found that the best companies to invest in, are the ones that have largest sum formed by a strictly increasing set of numbers (a set where the next element is always greater than the current element). But before I invest, I need to know the position of the first element of the consecutive increasing numbers. Help me so we can start investing already! Note: If it is already the last element of the row in the array, the next element is the first element of the next row, if there exists a next row. Input 1. Number of rows Description This is the number of rows of the multidimensional array. 2. Number of columns Description This is the number of columns of the multidimensional array. 3. Elements of the multidimensional array Output The first line will contain a message prompt to input the number of rows. The second line will contain a message prompt to input the…arrow_forward
- Bowling Stat's D.B W R В — 1 В - 2 В — 3 X%3D В —4 В — 5 4 10 2 27 1 14 13 40 3 5 7 12 2 3 22 37, As you can see, a particular row corresponds to a bowler, while the columns represent the information of overs bowled (O), dot-balls (D.B), wickets taken (W) and runs conceded (R). For example, Bowler (B-2) bowled 3 overs, 5 dot-balls, 3 wickets taken, and 14 runs conceded. Stats for other bowlers are represented by the other rows in a similar fashion. Write a MATLAB® script to compute a) The economy rate for each bowler. (hint: In cricket, a bowler's economy rate is total number of runs they have conceded per over bowled.) b) Which bowler has the lowest bowling average. (a player's bowling average is the number of runs they have conceded per wicket taken. hint: min command with index value will be helpful here). c) The total number of dot balls bowled by all five bowlers. (the sum command with appropriate dimension argument will be helpful here; see sum documentation for further help). d)…arrow_forwardQ4/Full the following blanks (1101 1010)BCD(5211) = ( )BCD(3321)=()EX-3=()16 * (1101 1010)BCD(5211) = (1110 1100)BCD(3321)=(1010110)EX-3= (A6)16 (1101 1010)BCD(5211) = (1110 0111)BCD(3321)=(1011001)EX-3= (56)16 (1101 1010)BCD(5211) = (1101 0111)BCD(3321)=(1011001)EX-3= (2B)16 (1101 1010)BCD(5211) = (1011 1110)BCD(3321)=(1000111)EX-3= (44)16 None of them IIarrow_forwardOne-dimensional range searching can be done with O(N log N) steps for preprocessing and O(R+log N) for range searching, where R is the number of points actually falling in the range.arrow_forward
- Factorial of a number is defined as: n! = n(n-1)(n-2)(n-3)...(2)(1) For example, 4! = 4*3*2*1 The n! can be written in terms of (n-1)! as: n! = n* (n-1)! (n-1)! = (n-1)*(n-2) ! and so forth. Thus, in order to compute n!, we need (n-1)!, to have (n-1)!, we need (n-2)! and so forth. As you may immediately notice, the base case for factorial is 1 because 1! = 1. Write a program that uses a recursive function called factorial that takes an integer n as its argument and returns n! to the main. C++ PLEASEarrow_forwardOrder the following functions by asymptotic growth rate (number 1 is the best algorithm, and number 3 is the worst). 4nlog n+2n 2log n n³ + 2arrow_forwardCashOrNothingOption = function(S, k, Time, r, q, sigma) {d1 = (log(S / k) + (r - q + sigma ^ 2 / 2) * Time) / (sigma * sqrt(Time))d2 = d1 - sigma * sqrt(Time)if(k>S){return (k * exp (-r * Time) * (-d2))}elseprint("zero")}arrow_forward
- In computer science and mathematics, the Josephus Problem (or Josephus permutation) is a theoretical problem. Following is the problem statement: There are n people standing in a circle waiting to be executed. The counting out begins at some point (rear) in the circle and proceeds around the circle in a fixed direction. In each step, a certain number (k) of people are skipped and the next person is executed. The elimination proceeds around the circle (which is becoming smaller and smaller as the executed people are removed), until only the last person remains, who is given freedom. Given the total number of persons n and a number k which indicates that k-1 persons are skipped and kth person is killed in circle. The task is to choose the place in the initial circle so that you are the last one remaining and so survive. For example, if n = 5 and k = 2, then the safe position is 3. Firstly, the person at position 2 is killed, then person at position 4 is killed, then person at position 1…arrow_forwardGiven A={1,2,3,4,56}, B= {2,4,5,6} and C= (1,6,7} 1. B' U C'=arrow_forwardAlgorithms Question Three points P, Q, and R are said to be collinear if they are on a single line. To check whether the 3 points lie on the same line, we use the distance formula. If P, Q and R are three collinear points, then: Distance from P to Q + Distance from Q to R = Distance from P to R PQ + QR = PR The distance between two points (x1, y1) and (x2, y2) is given by Hence, we can easily find the distance between the points P, Q and R, with the help of this formula. Design an algorithm (pseudocode) to check whether three points are collinear. In your solution include the input and the output.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education