C++ help
Background The value of can be computed using the following formula: 0 To evaluate this integral with computers, we can use the trapezoidal rule Your Work You will write two C++ programs that compute the value of using the following formula: For the first C++ program, the user w nput the number of intervals (N in the formula above), and your program should compute the value of and print the error (the built-in value of in C++ is M.PI) For the second C++ program, the user will instead input the maximum acceptable error, and your program should find the appropriate number of intervals to use such that the error tolerance is respected, then print the error and the number of intervals it used. To achieve this, your program should first try to evaluate the integral with a sma number of intervals, and try again with bigger numbers if the error is greater than the tolerance Note that there are several ways to write the second C++ program: for example, one could estimate the number of intervals to use with the asymptotic error formula of the trapezoidal rule. But to practice your C++ skills, you should stick to the method provided above. Also, you may want to enforce an upper limit to the number of intervals to try since the trapezoidal rule is only first-order and thus a very large number of intervals will be needed to satisfy any error tolerance less than 10- Background The value of can be computed using the following formula: 0 To evaluate this integral with computers, we can use the trapezoidal rule Your Work You will write two C++ programs that compute the value of using the following formula: For the first C++ program, the user w nput the number of intervals (N in the formula above), and your program should compute the value of and print the error (the built-in value of in C++ is M.PI) For the second C++ program, the user will instead input the maximum acceptable error, and your program should find the appropriate number of intervals to use such that the error tolerance is respected, then print the error and the number of intervals it used. To achieve this, your program should first try to evaluate the integral with a sma number of intervals, and try again with bigger numbers if the error is greater than the tolerance Note that there are several ways to write the second C++ program: for example, one could estimate the number of intervals to use with the asymptotic error formula of the trapezoidal rule. But to practice your C++ skills, you should stick to the method provided above. Also, you may want to enforce an upper limit to the number of intervals to try since the trapezoidal rule is only first-order and thus a very large number of intervals will be needed to satisfy any error tolerance less than 10