Compute square roots to a desired degree of accuracy

Assignment Help C/C++ Programming
Reference no: EM13705155

Question 1: You are to write a program which will compute square roots to a desired degree of accuracy.

Begin the program by prompting the user for two numbers: (1) the value for which to determine the square root and (2) the number of decimal places of accuracy desired in the result. For example, find the square root of 7 to four decimal places; the actual value is 2.6458.

On each pass of the inner event-controlled loops, display the current value of ?, the current approximation to the square root, and the error associated with the approximation.

Recall that the iomanip library contains manipulators to format output. At some point prior to the count-controlled loop, use fixed and setprecision(p) to show that floating point results should be displayed in a fixed number format, (nn.nnn and notn.nnE+nn), and that p decimal positions should be shown, even if all are trailing zeroes.

This need only be done once as fixed and setprecision will remain in effect until reset.

Use setw(w) to display a value in a total of w columns; this must be done for each individual value.

Reference no: EM13705155

Questions Cloud

Discuss the tcp and the udp application layer protocol : Discuss the TCP and the UDP application layer protocol. (the differences, advantages and disadvantages, services provided)
Data transmission protocol : A certain data transmission protocol the parity error detection concept is used. what does this mean?
An application-level and a circuit-level one : What is a gateway, and what is the difference between an application-level and a circuit-level one?
Futures of anomaly based instruction detection scheme : Explain the futures of anomaly based instruction detection scheme.
Compute square roots to a desired degree of accuracy : write a program which will compute square roots to a desired degree of accuracy.
What is the total file transfer time : How many packets must be transmitted to accomplish the file transfer - What is the total file transfer time.
Explain how many photons are produced each second : Problem- A typical 100-watt light bulb consumes 100J of energy per second. If a light bulb converts all of this energy to 500nm light, how many photons are produced each second
Evaluate a polynomial at a given real value : Write a function to evaluate a polynomial at a given real value a.
Create a function gcd : Create a function gcd(a, b) that receives two integers and returns the greatest common denominator of the two integers.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Recursive function returns number of vowels in a string

Write a recursive function, vowels, that returns the number of vowels in a string and write a program to test your function.

  Write a program that declares three one dimensional

Write a program that declares three one dimensional arrays named miles, gallons, and mpg . Each array should be declared in main( ) and should be capable of holding ten double

  Write a small program scropy

You are supposed to write a small program scropy, which takes two arguments on the command line: the names of a source file and a destination file.

  Program that compares the number of possible sequences

Write a c++ program that compares the number of possible sequences of the length L that can be generated. The program must output a formatted list comparing the number of possible sequences for L=5,6,7,8,9. given size N=9

  Prepare a program to print the permutation

write a program to print the permutation that lexicographically precedes the given input permutation. If the given permutation is the lexicographically least permutation, then print the input permutation itself.

  Write a c++ program to choose two three-digit primes

Write a C++ program to choose two three-digit primes and an encryption exponent (3 or 17 may do nicely).

  Create a customer profile class.

a. Create a CustomerProfile class. Each CustomerProfile contains a last name, phone number, and bit fields indicating whether the customer:

  A stack is referred to as a last-in first-out

This lab, along with your TA, will help you navigate through designing, implementing, and testing a dynamic stack. Recall, a stack data structure is a restricted linked list, where only the top node in the stack may be accessed at any given time

  Brownian motion is a physical phenomenon

Brownian motion is a physical phenomenon which can be observed, for instance, when a small particle is immersed in a liquid.

  Implementation of sorting technique

Implementation of sorting technique

  Your program will read the array

Your program will read the array from the file, check the diagonal and print a report containing the size and the status of the diagonal. A typical report would look like: The matrix is 3x3 and all the numbers on the main diagonal are the same.

  How the function delete can be implemented for arrays

Explain in details how the function Delete() can be implemented for arrays to function exactly as it would with lists. Use pseudo code to clarify your explanation.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd