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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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